Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions metricproviders/job/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package job

import (
"context"
"errors"
"fmt"
"testing"
"time"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
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"
Expand Down Expand Up @@ -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))
}
}
}
Expand Down
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
Expand Up @@ -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 := "-"
Expand Down
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
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubectl-argo-rollouts/cmd/undo/undo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 3 additions & 3 deletions rollout/restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package rollout

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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand Down
5 changes: 3 additions & 2 deletions rollout/trafficrouting/alb/alb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package alb
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"testing"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion rollout/trafficrouting/ambassador/ambassador.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/analysis/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down