chore: bump golangci-lint from v1.24 to v1.39
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
5811796eb4
commit
ac0d5d8bd3
|
@ -57,6 +57,10 @@ linters-settings:
|
||||||
list-type: blacklist
|
list-type: blacklist
|
||||||
packages:
|
packages:
|
||||||
- github.com/hashicorp/consul/command/flags
|
- github.com/hashicorp/consul/command/flags
|
||||||
|
gocritic:
|
||||||
|
disabled-checks:
|
||||||
|
- commentFormatting
|
||||||
|
- deprecatedComment
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude:
|
exclude:
|
||||||
|
|
|
@ -107,7 +107,7 @@ deps: ## Install build and development dependencies
|
||||||
lint-deps: ## Install linter dependencies
|
lint-deps: ## Install linter dependencies
|
||||||
## Keep versions in sync with tools/go.mod (see https://github.com/golang/go/issues/30515)
|
## Keep versions in sync with tools/go.mod (see https://github.com/golang/go/issues/30515)
|
||||||
@echo "==> Updating linter dependencies..."
|
@echo "==> Updating linter dependencies..."
|
||||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.39.0
|
||||||
go install github.com/client9/misspell/cmd/misspell@v0.3.4
|
go install github.com/client9/misspell/cmd/misspell@v0.3.4
|
||||||
go install github.com/hashicorp/go-hclog/hclogvet@v0.1.3
|
go install github.com/hashicorp/go-hclog/hclogvet@v0.1.3
|
||||||
|
|
||||||
|
|
|
@ -720,7 +720,7 @@ func (c *Client) doRequest(r *request) (time.Duration, *http.Response, error) {
|
||||||
}
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
resp, err := c.httpClient.Do(req)
|
resp, err := c.httpClient.Do(req)
|
||||||
diff := time.Now().Sub(start)
|
diff := time.Since(start)
|
||||||
|
|
||||||
// If the response is compressed, we swap the body's reader.
|
// If the response is compressed, we swap the body's reader.
|
||||||
if resp != nil && resp.Header != nil {
|
if resp != nil && resp.Header != nil {
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (v *CSIVolumes) CreateSnapshot(snap *CSISnapshot, w *WriteOptions) ([]*CSIS
|
||||||
Snapshots: []*CSISnapshot{snap},
|
Snapshots: []*CSISnapshot{snap},
|
||||||
}
|
}
|
||||||
resp := &CSISnapshotCreateResponse{}
|
resp := &CSISnapshotCreateResponse{}
|
||||||
meta, err := v.client.write(fmt.Sprintf("/v1/volumes/snapshot"), req, resp, w)
|
meta, err := v.client.write("/v1/volumes/snapshot", req, resp, w)
|
||||||
return resp.Snapshots, meta, err
|
return resp.Snapshots, meta, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ func (v *CSIVolumes) DeleteSnapshot(snap *CSISnapshot, w *WriteOptions) error {
|
||||||
req := &CSISnapshotDeleteRequest{
|
req := &CSISnapshotDeleteRequest{
|
||||||
Snapshots: []*CSISnapshot{snap},
|
Snapshots: []*CSISnapshot{snap},
|
||||||
}
|
}
|
||||||
_, err := v.client.delete(fmt.Sprintf("/v1/volumes/snapshot"), req, w)
|
_, err := v.client.delete("/v1/volumes/snapshot", req, w)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -691,9 +691,7 @@ func (m *Multiregion) Copy() *Multiregion {
|
||||||
copyRegion := new(MultiregionRegion)
|
copyRegion := new(MultiregionRegion)
|
||||||
copyRegion.Name = region.Name
|
copyRegion.Name = region.Name
|
||||||
copyRegion.Count = intToPtr(*region.Count)
|
copyRegion.Count = intToPtr(*region.Count)
|
||||||
for _, dc := range region.Datacenters {
|
copyRegion.Datacenters = append(copyRegion.Datacenters, region.Datacenters...)
|
||||||
copyRegion.Datacenters = append(copyRegion.Datacenters, dc)
|
|
||||||
}
|
|
||||||
for k, v := range region.Meta {
|
for k, v := range region.Meta {
|
||||||
copyRegion.Meta[k] = v
|
copyRegion.Meta[k] = v
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,8 +224,7 @@ func (n *Nodes) monitorDrainNode(ctx context.Context, nodeID string,
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.DrainStrategy == nil {
|
if node.DrainStrategy == nil {
|
||||||
var msg *MonitorMessage
|
msg := Messagef(MonitorMsgLevelInfo, "Drain complete for node %s", nodeID)
|
||||||
msg = Messagef(MonitorMsgLevelInfo, "Drain complete for node %s", nodeID)
|
|
||||||
select {
|
select {
|
||||||
case nodeCh <- msg:
|
case nodeCh <- msg:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
|
|
@ -24,9 +24,9 @@ func (s *Scaling) ListPolicies(q *QueryOptions) ([]*ScalingPolicyListStub, *Quer
|
||||||
return resp, qm, nil
|
return resp, qm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Scaling) GetPolicy(ID string, q *QueryOptions) (*ScalingPolicy, *QueryMeta, error) {
|
func (s *Scaling) GetPolicy(id string, q *QueryOptions) (*ScalingPolicy, *QueryMeta, error) {
|
||||||
var policy ScalingPolicy
|
var policy ScalingPolicy
|
||||||
qm, err := s.client.query("/v1/scaling/policy/"+ID, &policy, q)
|
qm, err := s.client.query("/v1/scaling/policy/"+id, &policy, q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
10
api/tasks.go
10
api/tasks.go
|
@ -165,12 +165,12 @@ type Affinity struct {
|
||||||
Weight *int8 `hcl:"weight,optional"` // Weight applied to nodes that match the affinity. Can be negative
|
Weight *int8 `hcl:"weight,optional"` // Weight applied to nodes that match the affinity. Can be negative
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAffinity(LTarget string, Operand string, RTarget string, Weight int8) *Affinity {
|
func NewAffinity(lTarget string, operand string, rTarget string, weight int8) *Affinity {
|
||||||
return &Affinity{
|
return &Affinity{
|
||||||
LTarget: LTarget,
|
LTarget: lTarget,
|
||||||
RTarget: RTarget,
|
RTarget: rTarget,
|
||||||
Operand: Operand,
|
Operand: operand,
|
||||||
Weight: int8ToPtr(Weight),
|
Weight: int8ToPtr(weight),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ func (f *EnvAWSFingerprint) Fingerprint(request *FingerprintRequest, response *F
|
||||||
}
|
}
|
||||||
|
|
||||||
// assume we want blank entries
|
// assume we want blank entries
|
||||||
key := "platform.aws." + strings.Replace(k, "/", ".", -1)
|
key := "platform.aws." + strings.ReplaceAll(k, "/", ".")
|
||||||
if unique {
|
if unique {
|
||||||
key = structs.UniqueNamespace(key)
|
key = structs.UniqueNamespace(key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ func (f *EnvAzureFingerprint) Fingerprint(request *FingerprintRequest, response
|
||||||
}
|
}
|
||||||
|
|
||||||
// assume we want blank entries
|
// assume we want blank entries
|
||||||
key := "platform.azure." + strings.Replace(k, "/", ".", -1)
|
key := "platform.azure." + strings.ReplaceAll(k, "/", ".")
|
||||||
if attr.unique {
|
if attr.unique {
|
||||||
key = structs.UniqueNamespace(key)
|
key = structs.UniqueNamespace(key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ func (f *EnvGCEFingerprint) Fingerprint(req *FingerprintRequest, resp *Fingerpri
|
||||||
}
|
}
|
||||||
|
|
||||||
// assume we want blank entries
|
// assume we want blank entries
|
||||||
key := "platform.gce." + strings.Replace(k, "/", ".", -1)
|
key := "platform.gce." + strings.ReplaceAll(k, "/", ".")
|
||||||
if unique {
|
if unique {
|
||||||
key = structs.UniqueNamespace(key)
|
key = structs.UniqueNamespace(key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ func (a *TestAgent) Start() *TestAgent {
|
||||||
if a.Name != "" {
|
if a.Name != "" {
|
||||||
name = a.Name + "-agent"
|
name = a.Name + "-agent"
|
||||||
}
|
}
|
||||||
name = strings.Replace(name, "/", "_", -1)
|
name = strings.ReplaceAll(name, "/", "_")
|
||||||
d, err := ioutil.TempDir(TempDir, name)
|
d, err := ioutil.TempDir(TempDir, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.T.Fatalf("Error creating data dir %s: %s", filepath.Join(TempDir, name), err)
|
a.T.Fatalf("Error creating data dir %s: %s", filepath.Join(TempDir, name), err)
|
||||||
|
|
|
@ -159,7 +159,7 @@ func getDeployment(client *api.Deployments, dID string) (match *api.Deployment,
|
||||||
return d, nil, nil
|
return d, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
dID = strings.Replace(dID, "-", "", -1)
|
dID = strings.ReplaceAll(dID, "-", "")
|
||||||
if len(dID) == 1 {
|
if len(dID) == 1 {
|
||||||
return nil, nil, fmt.Errorf("Identifier must contain at least two characters.")
|
return nil, nil, fmt.Errorf("Identifier must contain at least two characters.")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
multierror "github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
"github.com/hashicorp/nomad/api"
|
"github.com/hashicorp/nomad/api"
|
||||||
"github.com/hashicorp/nomad/command/agent"
|
"github.com/hashicorp/nomad/command/agent"
|
||||||
flaghelper "github.com/hashicorp/nomad/helper/flags"
|
flaghelper "github.com/hashicorp/nomad/helper/flags"
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ func TarCZF(archive string, src, target string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove leading path to the src, so files are relative to the archive
|
// remove leading path to the src, so files are relative to the archive
|
||||||
path := strings.Replace(file, src, "", -1)
|
path := strings.ReplaceAll(file, src, "")
|
||||||
if target != "" {
|
if target != "" {
|
||||||
path = filepath.Join([]string{target, path}...)
|
path = filepath.Join([]string{target, path}...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1159,7 +1159,7 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T
|
||||||
|
|
||||||
config.Env = task.EnvList()
|
config.Env = task.EnvList()
|
||||||
|
|
||||||
containerName := fmt.Sprintf("%s-%s", strings.Replace(task.Name, "/", "_", -1), task.AllocID)
|
containerName := fmt.Sprintf("%s-%s", strings.ReplaceAll(task.Name, "/", "_"), task.AllocID)
|
||||||
logger.Debug("setting container name", "container_name", containerName)
|
logger.Debug("setting container name", "container_name", containerName)
|
||||||
|
|
||||||
var networkingConfig *docker.NetworkingConfig
|
var networkingConfig *docker.NetworkingConfig
|
||||||
|
|
|
@ -20,7 +20,7 @@ func checkForMacJVM() (ok bool, err error) {
|
||||||
cmd.Stderr = &out
|
cmd.Stderr = &out
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("failed check for macOS jvm: %v, out: %v", err, strings.Replace(strings.Replace(out.String(), "\n", " ", -1), `"`, `\"`, -1))
|
err = fmt.Errorf("failed check for macOS jvm: %v, out: %v", err, strings.ReplaceAll(strings.ReplaceAll(out.String(), "\n", " "), `"`, `\"`))
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
|
@ -73,7 +73,7 @@ func NewExecutorWithIsolation(logger hclog.Logger) Executor {
|
||||||
logger.Error("unable to initialize stats", "error", err)
|
logger.Error("unable to initialize stats", "error", err)
|
||||||
}
|
}
|
||||||
return &LibcontainerExecutor{
|
return &LibcontainerExecutor{
|
||||||
id: strings.Replace(uuid.Generate(), "-", "_", -1),
|
id: strings.ReplaceAll(uuid.Generate(), "-", "_"),
|
||||||
logger: logger,
|
logger: logger,
|
||||||
totalCpuStats: stats.NewCpuStats(),
|
totalCpuStats: stats.NewCpuStats(),
|
||||||
userCpuStats: stats.NewCpuStats(),
|
userCpuStats: stats.NewCpuStats(),
|
||||||
|
|
|
@ -218,7 +218,7 @@ func (r *TestReport) Summary() string {
|
||||||
fmt.Fprintf(w, "[%s]\t\t↳\t%s\t (%vs)\n", status, tname, test.Elapsed)
|
fmt.Fprintf(w, "[%s]\t\t↳\t%s\t (%vs)\n", status, tname, test.Elapsed)
|
||||||
if test.Failed {
|
if test.Failed {
|
||||||
for _, line := range test.Output[2:] {
|
for _, line := range test.Output[2:] {
|
||||||
fmt.Fprintf(w, "\t\t\t%s\n", strings.Replace(strings.TrimSpace(line), "\t", " ", -1))
|
fmt.Fprintf(w, "\t\t\t%s\n", strings.ReplaceAll(strings.TrimSpace(line), "\t", " "))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "\t\t\t----------")
|
fmt.Fprintln(w, "\t\t\t----------")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue