From cb8505afdc05ea6672c390829a904a4aa7ae18ac Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Thu, 19 Dec 2024 09:25:48 +0100 Subject: [PATCH] update linter configuration, linter finds --- .github/workflows/lint.yaml | 2 +- .golangci.yml | 15 +++++++-------- auth/tokenizer.go | 2 +- service/cluster/cluster.go | 2 -- service/flavor.go | 1 - 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 4e83330e6..fc65a7676 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -26,7 +26,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.58 + version: v1.62 shellcheck: runs-on: ubuntu-latest diff --git a/.golangci.yml b/.golangci.yml index 88933334b..1576d6740 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,12 @@ run: timeout: 16m + go: "1.23" output: - format: "junit-xml:report.xml,colored-line-number" + formats: + - format: colored-line-number + - format: junit-xml + path: report.xml issues: exclude-use-default: false @@ -36,7 +40,7 @@ linters-settings: includes: - G601 revive: - min-confidence: 0 + confidence: 0 govet: enable-all: true disable: @@ -56,16 +60,11 @@ linters-settings: - Warnf - Error - Errorf - gocritic: - enabled-checks: - - commentFormatting nolintlint: - allow-leading-space: false # require machine-readable nolint directives (i.e. with no leading space) allow-unused: false # report any unused nolint directives require-explanation: false # don't require an explanation for nolint directives require-specific: true # require nolint directives to be specific about which linter is being skipped staticcheck: - go: "1.20" checks: [all, -ST1000, -ST1001, -ST1003, -ST1005, -SA1019, -SA4001, -ST1016] wrapcheck: ignoreSigRegexps: @@ -81,6 +80,7 @@ linters: enable: - asciicheck # - bodyclose + - copyloopvar # - deadcode # - depguard # - dogsled @@ -92,7 +92,6 @@ linters: # - gochecknoinits # - gocognit # - goconst - - exportloopref - gocritic # - gocyclo # - godot diff --git a/auth/tokenizer.go b/auth/tokenizer.go index f64170e1c..9c2ec6177 100644 --- a/auth/tokenizer.go +++ b/auth/tokenizer.go @@ -128,7 +128,7 @@ func (c oidcClaims) Valid() error { case !strings.HasSuffix(c.Email, emailSuffixRedHat): errMsg := "email address does not belong to Red Hat" log.AuditLog(logging.INFO, "oidc-claim-validation", errMsg, "email", c.Email) - return errors.Errorf(errMsg) + return errors.New(errMsg) default: // Use an empty jwt.Expected to skip non-time-related validation and use time.Now() // for the validation. diff --git a/service/cluster/cluster.go b/service/cluster/cluster.go index d1f579cf7..b12f94d4d 100644 --- a/service/cluster/cluster.go +++ b/service/cluster/cluster.go @@ -168,8 +168,6 @@ func (s *clusterImpl) List(ctx context.Context, request *v1.ClusterListRequest) // Loop over all of the workflows, and keep only the ones that match our // request criteria. for _, workflow := range workflowList.Items { - workflow := workflow - // This cluster is expired, and we did not request to include expired // clusters. if !request.Expired && isWorkflowExpired(workflow) { diff --git a/service/flavor.go b/service/flavor.go index e2159e23e..20bafb848 100644 --- a/service/flavor.go +++ b/service/flavor.go @@ -34,7 +34,6 @@ func NewFlavorService(registry *flavor.Registry) (middleware.APIService, error) func (s *flavorImpl) List(_ context.Context, request *v1.FlavorListRequest) (*v1.FlavorListResponse, error) { var resp v1.FlavorListResponse for _, flavor := range s.registry.Flavors() { - flavor := flavor if !request.All && flavor.Availability == v1.Flavor_alpha { continue }