Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update golangci-lint to v1.61.0 #3857

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: update golangci-lint to v1.61.0
Signed-off-by: william.vanhevelingen <william.vanhevelingen@acquia.com>
blkperl authored and zachaller committed Dec 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 5ec552443aac1ef2f2834bfdce6778236c4e499c
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.57.2
version: v1.61.0
args: --timeout 6m
build:
name: Build
17 changes: 9 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
run:
deadline: 1m
skip-files:
- ".*\\.pb\\.go"
skip-dirs:
- pkg/client
timeout: 10m
modules-download-mode: readonly
issues:
exclude-dirs:
- pkg/client
exclude-files:
- ".*\\.pb\\.go"
linter-settings:
goimports:
local-prefixes: github.com/argoproj/argo-rollouts
linters:
enable:
- vet
- gofmt
- goimports
- unused
- govet
- ineffassign
- unconvert
- misspell
- unconvert
- unused
disable-all: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install golangci-lint
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2 && \
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0 && \
golangci-lint linters

COPY .golangci.yml ${GOPATH}/src/dummy/.golangci.yml
5 changes: 3 additions & 2 deletions metricproviders/job/job_test.go
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ package job

import (
"context"
"errors"
"fmt"
"testing"
"time"
@@ -178,7 +179,7 @@ func TestRunCreateFail(t *testing.T) {
// The following causes the Create call to fail
fakeClient := p.kubeclientset.(*k8sfake.Clientset)
fakeClient.PrependReactor("create", "*", func(action kubetesting.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, fmt.Errorf(errMsg)
return true, nil, errors.New(errMsg)
})
metricsMetadata := p.GetMetadata(run.Spec.Metrics[0])
assert.Nil(t, metricsMetadata)
@@ -269,7 +270,7 @@ func TestTerminateError(t *testing.T) {
errMsg := "random delete error"
fakeClient := p.kubeclientset.(*k8sfake.Clientset)
fakeClient.PrependReactor("delete", "*", func(action kubetesting.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, fmt.Errorf(errMsg)
return true, nil, errors.New(errMsg)
})

measurement = p.Terminate(run, run.Spec.Metrics[0], measurement)
5 changes: 3 additions & 2 deletions pkg/apis/rollouts/validation/validation_references.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package validation

import (
"errors"
"fmt"

appsv1 "k8s.io/api/apps/v1"
@@ -342,11 +343,11 @@ func ValidateRolloutVirtualServicesConfig(r *v1alpha1.Rollout) error {
if canary.TrafficRouting != nil && canary.TrafficRouting.Istio != nil {
if istioutil.MultipleVirtualServiceConfigured(r) {
if r.Spec.Strategy.Canary.TrafficRouting.Istio.VirtualService != nil {
return field.InternalError(fldPath, fmt.Errorf(errorString))
return field.InternalError(fldPath, errors.New(errorString))
}
} else {
if r.Spec.Strategy.Canary.TrafficRouting.Istio.VirtualService == nil {
return field.InternalError(fldPath, fmt.Errorf(errorString))
return field.InternalError(fldPath, errors.New(errorString))
}
}
}
2 changes: 1 addition & 1 deletion pkg/kubectl-argo-rollouts/cmd/list/list_experiments.go
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ func (o *ListOptions) PrintExperimentTable(expList *v1alpha1.ExperimentList) err
headerStr = "NAMESPACE\t" + headerStr
fmtStr = "%-9s\t" + fmtStr
}
fmt.Fprintf(w, headerStr)
fmt.Fprint(w, headerStr)
for _, exp := range expList.Items {
age := duration.HumanDuration(timeutil.MetaNow().Sub(exp.CreationTimestamp.Time))
dur := "-"
2 changes: 1 addition & 1 deletion pkg/kubectl-argo-rollouts/cmd/list/list_rollouts.go
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ func (o *ListOptions) PrintRolloutTable(roList *v1alpha1.RolloutList) error {
if o.timestamps {
headerStr = "TIMESTAMP\t" + headerStr
}
fmt.Fprintf(w, headerStr)
fmt.Fprint(w, headerStr)
for _, ro := range roList.Items {
roLine := newRolloutInfo(ro)
fmt.Fprintln(w, roLine.String(o.timestamps, o.allNamespaces))
2 changes: 1 addition & 1 deletion pkg/kubectl-argo-rollouts/cmd/undo/undo.go
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ func NewCmdUndo(o *options.ArgoRolloutsOptions) *cobra.Command {
if err != nil {
return err
}
fmt.Fprintf(o.Out, result)
fmt.Fprint(o.Out, result)
return nil
},
ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o),
6 changes: 3 additions & 3 deletions rollout/restart_test.go
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ package rollout

import (
"bytes"
"fmt"
"errors"
"testing"
"time"

@@ -199,7 +199,7 @@ func TestRestartReconcile(t *testing.T) {
}
client.PrependReactor("create", "pods", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
// this is the pod eviction
return true, nil, fmt.Errorf(expectedErrMsg)
return true, nil, errors.New(expectedErrMsg)
})
r := RolloutPodRestarter{
client: client,
@@ -309,7 +309,7 @@ func TestRestartReplicaSetPod(t *testing.T) {
client := fake.NewSimpleClientset()
expectedErrMsg := "big bad error"
client.PrependReactor("list", "pods", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, fmt.Errorf(expectedErrMsg)
return true, nil, errors.New(expectedErrMsg)
})
r := RolloutPodRestarter{client: client}
roCtx := &rolloutContext{
5 changes: 3 additions & 2 deletions rollout/trafficrouting/alb/alb_test.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package alb
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"testing"
@@ -668,7 +669,7 @@ func TestErrorPatching(t *testing.T) {

errMessage := "some error occurred"
r.cfg.Client.(*fake.Clientset).Fake.AddReactor("patch", "ingresses", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, fmt.Errorf(errMessage)
return true, nil, errors.New(errMessage)
})

err = r.SetWeight(10)
@@ -700,7 +701,7 @@ func TestErrorPatchingMultiIngress(t *testing.T) {

errMessage := "some error occurred"
r.cfg.Client.(*fake.Clientset).Fake.AddReactor("patch", "ingresses", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, fmt.Errorf(errMessage)
return true, nil, errors.New(errMessage)
})

err = r.SetWeight(10)
2 changes: 1 addition & 1 deletion rollout/trafficrouting/ambassador/ambassador.go
Original file line number Diff line number Diff line change
@@ -213,7 +213,7 @@ func (r *Reconciler) createCanaryMapping(ctx context.Context,
if weight != 0 {
msg := fmt.Sprintf("Ambassador mapping %q can not define weight", baseMappingName)
r.sendWarningEvent(AmbassadorMappingConfigError, msg)
return fmt.Errorf(msg)
return errors.New(msg)
}

canarySvc := r.Rollout.Spec.Strategy.Canary.CanaryService
2 changes: 1 addition & 1 deletion utils/analysis/factory_test.go
Original file line number Diff line number Diff line change
@@ -478,7 +478,7 @@ func TestResolveMetricArgsWithQuotes(t *testing.T) {
}
newMetric, err := ResolveMetricArgs(metric, arguments)
assert.NoError(t, err)
assert.Equal(t, fmt.Sprintf(arg), newMetric.SuccessCondition)
assert.Equal(t, arg, newMetric.SuccessCondition)
}

func Test_extractValueFromRollout(t *testing.T) {