You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The errors reported by golangci-lint fall into 2 groups:
printf: non-constant format string in call to fmt.Errorf
S1009: should omit nil check ; len() for []string is defined as zero
make lint-local
golangci-lint --version
golangci-lint has version 1.60.3 built with go1.23.0 from c2e095c on 2024-08-22T21:45:24Z
# NOTE: If you get a "Killed" OOM message, try reducing the value of GOGC# See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
GOGC=20 GOMAXPROCS=2 golangci-lint run --fix --verbose
INFO golangci-lint has version 1.60.3 built with go1.23.0 from c2e095c on 2024-08-22T21:45:24Z
INFO [config_reader] Config search paths: [./ /Users/cfang/go/src/argo-cd /Users/cfang/go/src /Users/cfang/go /Users/cfang /Users /]
INFO [config_reader] Used config file .golangci.yaml
INFO [lintersdb] Active 14 linters: [errcheck errorlint gocritic gofumpt goimports gosimple govet ineffassign misspell staticcheck testifylint unparam unused whitespace]
INFO [loader] Go packages loading at mode 575 (types_sizes|deps|files|imports|name|compiled_files|exports_file) took 23.449423125s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 125.665375ms
INFO [linters_context/goanalysis] analyzers took 9m54.514136517s with top 10 stages: buildir: 1m44.142901291s, buildssa: 26.353892337s, unparam: 19.919675829s, gofumpt: 17.928837786s, goimports: 14.970337712s, gocritic: 9.006864623s, errorlint: 8.609459956s, misspell: 7.238377835s, directives: 6.503166495s, S1038: 6.248598826s
INFO [runner] fixer took 0s with no stages
INFO [runner] Issues before processing: 4451, after processing: 34
INFO [runner] Processors filtering stat (in/out): sort_results: 34/34, nolint: 113/38, autogenerated_exclude: 4451/246, identifier_marker: 246/246, max_same_issues: 34/34, source_code: 34/34, skip_dirs: 4451/4451, invalid_issue: 4451/4451, exclude: 246/246, diff: 34/34, max_per_file_from_linter: 34/34, max_from_linter: 34/34, severity-rules: 34/34, fixer: 34/34, cgo: 4451/4451, path_prefixer: 34/34, path_prettifier: 4451/4451, skip_files: 4451/4451, exclude-rules: 246/113, uniq_by_line: 38/34, path_shortener: 34/34, filename_unadjuster: 4451/4451
INFO [runner] processing took 47.871127ms with stages: nolint: 33.232042ms, autogenerated_exclude: 4.112417ms, exclude-rules: 3.034291ms, path_prettifier: 2.864626ms, identifier_marker: 1.890917ms, source_code: 875.916µs, skip_dirs: 825.125µs, exclude: 391.626µs, invalid_issue: 303.666µs, cgo: 175.875µs, filename_unadjuster: 126.542µs, fixer: 23.542µs, uniq_by_line: 8.834µs, path_shortener: 3.416µs, max_per_file_from_linter: 916ns, max_same_issues: 625ns, skip_files: 250ns, sort_results: 208ns, diff: 167ns, path_prefixer: 42ns, severity-rules: 42ns, max_from_linter: 42ns
INFO [runner] linters took 18.942572583s with stages: goanalysis_metalinter: 18.894653375s
util/test/testutil.go:194:13: SA6006: use io.Writer.Write instead of converting from []byte to string to use io.WriteString (staticcheck)
_, err = io.WriteString(w, string(out))
^
util/grpc/errors.go:15:29: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return status.Errorf(code, err.Error())
^
util/grpc/errors_test.go:28:57: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
grpcError := gitErrToGRPC(status.Errorf(codes.Unknown, grpcErrorMsg))
^
util/grpc/errors_test.go:35:57: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
notFound := gitErrToGRPC(status.Errorf(codes.NotFound, notFoundMsg))
^
util/kube/portforwarder.go:103:25: printf: non-constant format string in call to fmt.Errorf (govet)
return -1, fmt.Errorf(errOut.String())
^
applicationset/controllers/applicationset_controller.go:1038:7: S1009: should omit nil check;len() for []string is defined as zero (gosimple)
if currentAppStatus.TargetRevisions == nil || len(currentAppStatus.TargetRevisions) == 0 {
^
applicationset/generators/git.go:81:18: S1009: should omit nil check;len() for []github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1.SignatureKey is defined as zero (gosimple)
verifyCommit = appProject.Spec.SignatureKeys != nil && len(appProject.Spec.SignatureKeys) > 0 &&gpg.IsGPGEnabled()
^
applicationset/utils/utils.go:276:4: S1009: should omit nil check;len() for []string is defined as zero (gosimple)
(replacedTmpl.ObjectMeta.Finalizers == nil || len(replacedTmpl.ObjectMeta.Finalizers) == 0) {
^
cmd/argocd/commands/app.go:1258:43: S1009: should omit nil check;len() for []string is defined as zero (gosimple)
} elseif diffOptions.revision != ""|| (diffOptions.revisions != nil && len(diffOptions.revisions) > 0) {
^
controller/state.go:423:5: S1009: should omit nil check;len() for []github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1.SignatureKey is defined as zero (gosimple)
if project.Spec.SignatureKeys != nil && len(project.Spec.SignatureKeys) > 0 &&gpg.IsGPGEnabled() {
^
pkg/apis/application/v1alpha1/types.go:236:9: S1009: should omit nil check;len() for github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1.ApplicationSources is defined as zero (gosimple)
return a.Sources != nil && len(a.Sources) > 0
^
util/argo/argo.go:885:5: S1009: should omit nil check;len() for github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1.ApplicationSources is defined as zero (gosimple)
if spec.Sources != nil && len(spec.Sources) > 0 {
^
server/repocreds/repocreds.go:96:53: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, status.Errorf(codes.InvalidArgument, argo.GenerateSpecIsDifferentErrorMessage("repository credentials", existing, r))
^
hack/gen-resources/generators/cluster_generator.go:160:13: printf: non-constant format string in call to log.Printf (govet)
log.Printf("Get service for https://" + pod.Status.PodIP + ":8443")
^
test/e2e/fixture/applicationsets/utils/fixture.go:271:20: printf: non-constant format string in call to fmt.Errorf (govet)
return fmt.Errorf(msg)
^
test/e2e/fixture/cluster/actions.go:63:15: printf: non-constant format string in call to log.Fatalf (govet)
log.Fatalf(fmt.Sprintf("Failed to upsert cluster %v", err.Error()))
^
applicationset/generators/duck_type.go:221:16: printf: non-constant format string in call to github.com/sirupsen/logrus.Warningf (govet)
log.Warningf("clusterDecisionResource status." + statusListKey + " missing")
^
applicationset/services/scm_provider/bitbucket_cloud.go:49:27: printf: non-constant format string in call to fmt.Errorf (govet)
return false, fmt.Errorf(resp.Status)
^
cmd/argocd/commands/app.go:1909:17: printf: non-constant format string in call to github.com/sirupsen/logrus.Fatalf (govet)
log.Fatalf(errMsg)
^
controller/appcontroller.go:2025:17: printf: non-constant format string in call to (*github.com/sirupsen/logrus.Entry).Warnf (govet)
logCtx.Warnf(message)
^
server/application/application.go:184:52: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, nil, status.Errorf(codes.NotFound, apierr.NewNotFound(schema.GroupResource{Group: "argoproj.io", Resource: "applications"}, name).Error())
^
server/application/application.go:206:51: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, nil, status.Errorf(codes.NotFound, apierr.NewNotFound(schema.GroupResource{Group: "argoproj.io", Resource: "applications"}, name).Error())
^
server/application/application.go:223:50: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, nil, status.Errorf(codes.NotFound, apierr.NewNotFound(schema.GroupResource{Group: "argoproj.io", Resource: "applications"}, name).Error())
^
^
server/application/application.go:2004:70: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return"", "", nil, nil, status.Errorf(codes.FailedPrecondition, err.Error())
^
server/application/application.go:2019:69: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return"", "", nil, nil, status.Errorf(codes.FailedPrecondition, err.Error())
^
server/cluster/cluster.go:168:54: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, status.Errorf(codes.InvalidArgument, argo.GenerateSpecIsDifferentErrorMessage("cluster", existing, c))
^
server/logout/logout_test.go:387:15: printf: non-constant format string in call to (*testing.common).Errorf (govet)
t.Errorf(tt.responseRecorder.Body.String())
^
server/logout/logout_test.go:388:15: printf: non-constant format string in call to (*testing.common).Errorf (govet)
t.Errorf("handler returned wrong status code: " + fmt.Sprintf("%d", tt.responseRecorder.Code))
^
server/project/project.go:117:52: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, status.Errorf(codes.InvalidArgument, err.Error())
^
server/project/project.go:276:54: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, status.Errorf(codes.InvalidArgument, argo.GenerateSpecIsDifferentErrorMessage("project", existing.Spec, q.GetProject().Spec))
^
server/repository/repository.go:446:53: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, status.Errorf(codes.InvalidArgument, argo.GenerateSpecIsDifferentErrorMessage("repository", existing, r))
^
util/db/repository_secrets.go:42:47: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, status.Errorf(codes.Internal, err.Error())
^
util/db/repository_secrets.go:46:54: printf: non-constant format string in call to google.golang.org/grpc/status.Errorf (govet)
return nil, status.Errorf(codes.InvalidArgument, msg)
^
util/notification/settings/legacy.go:153:28: printf: non-constant format string in call to fmt.Sprintf (govet)
cfg.Services[fmt.Sprintf(opts.Name)] = func() (services.NotificationService, error) {
^
To Reproduce make lint-local
or run golangci-lint directly:
golangci-lint run
Expected behavior
the above commands should completely with no errors.
Checklist:
argocd version
.Describe the bug
The errors reported by golangci-lint fall into 2 groups:
To Reproduce
make lint-local
or run golangci-lint directly:
golangci-lint run
Expected behavior
the above commands should completely with no errors.
Screenshots
Version
Logs
The text was updated successfully, but these errors were encountered: