From 37ee9f65fcfb5969f9a29ae4ecf003725a77993e Mon Sep 17 00:00:00 2001 From: Vince Prignano Date: Tue, 2 Apr 2024 08:09:25 -0700 Subject: [PATCH] Update golanci-lint to v1.57.2 Signed-off-by: Vince Prignano --- .github/workflows/golangci-lint.yml | 4 ++-- .golangci.yml | 16 +++++++++------- pkg/manager/internal.go | 16 ++++------------ tools/setup-envtest/store/store.go | 2 +- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index de0630923f..7baade1aa4 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,12 +26,12 @@ jobs: - name: Set up Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # tag=v5.0.0 with: - go-version: '1.22' + go-version: "1.22" cache: false - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # tag=v4.1.2 - name: golangci-lint uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # tag=v4.0.0 with: - version: v1.56.2 + version: v1.57.2 args: --out-format=colored-line-number working-directory: ${{matrix.working-directory}} diff --git a/.golangci.yml b/.golangci.yml index e0a56c91a2..4c43665e2b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -41,6 +41,11 @@ linters: - whitespace linters-settings: + govet: + enable-all: true + disable: + - fieldalignment + - shadow importas: no-unaliased: true alias: @@ -58,10 +63,6 @@ linters-settings: # Controller Runtime - pkg: sigs.k8s.io/controller-runtime alias: ctrl - staticcheck: - go: "1.22" - stylecheck: - go: "1.22" revive: rules: # The following rules are recommended https://github.com/mgechev/revive#recommended-configuration @@ -105,6 +106,9 @@ issues: - Subprocess launch(ed with variable|ing should be audited) - (G204|G104|G307) - "ST1000: at least one file in a package should have a package comment" + exclude-files: + - "zz_generated.*\\.go$" + - ".*conversion.*\\.go$" exclude-rules: - linters: - gosec @@ -163,8 +167,6 @@ issues: path: _test\.go run: + go: "1.22" timeout: 10m - skip-files: - - "zz_generated.*\\.go$" - - ".*conversion.*\\.go$" allow-parallel-runners: true diff --git a/pkg/manager/internal.go b/pkg/manager/internal.go index fdb9d982d9..aca1a88ea6 100644 --- a/pkg/manager/internal.go +++ b/pkg/manager/internal.go @@ -389,9 +389,7 @@ func (cm *controllerManager) Start(ctx context.Context) (err error) { // WARNING: Internal HTTP servers MUST start before any cache is populated, otherwise it would block // conversion webhooks to be ready for serving which make the cache never get ready. if err := cm.runnables.HTTPServers.Start(cm.internalCtx); err != nil { - if err != nil { - return fmt.Errorf("failed to start HTTP servers: %w", err) - } + return fmt.Errorf("failed to start HTTP servers: %w", err) } // Start any webhook servers, which includes conversion, validation, and defaulting @@ -401,23 +399,17 @@ func (cm *controllerManager) Start(ctx context.Context) (err error) { // between conversion webhooks and the cache sync (usually initial list) which causes the webhooks // to never start because no cache can be populated. if err := cm.runnables.Webhooks.Start(cm.internalCtx); err != nil { - if err != nil { - return fmt.Errorf("failed to start webhooks: %w", err) - } + return fmt.Errorf("failed to start webhooks: %w", err) } // Start and wait for caches. if err := cm.runnables.Caches.Start(cm.internalCtx); err != nil { - if err != nil { - return fmt.Errorf("failed to start caches: %w", err) - } + return fmt.Errorf("failed to start caches: %w", err) } // Start the non-leaderelection Runnables after the cache has synced. if err := cm.runnables.Others.Start(cm.internalCtx); err != nil { - if err != nil { - return fmt.Errorf("failed to start other runnables: %w", err) - } + return fmt.Errorf("failed to start other runnables: %w", err) } // Start the leader election and all required runnables. diff --git a/tools/setup-envtest/store/store.go b/tools/setup-envtest/store/store.go index e6f258e4ac..7dbe3392a6 100644 --- a/tools/setup-envtest/store/store.go +++ b/tools/setup-envtest/store/store.go @@ -182,7 +182,7 @@ func (s *Store) Add(ctx context.Context, item Item, contents io.Reader) (resErr return err } } - if err != nil && !errors.Is(err, io.EOF) { + if err != nil && !errors.Is(err, io.EOF) { //nolintL:govet return fmt.Errorf("unable to finish un-tar-ing the downloaded archive: %w", err) } log.V(1).Info("unpacked archive")