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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Update golanci-lint to v1.57.2 #2751

Merged
merged 1 commit into from Apr 3, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Expand Up @@ -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}}
16 changes: 9 additions & 7 deletions .golangci.yml
Expand Up @@ -41,6 +41,11 @@ linters:
- whitespace

linters-settings:
govet:
enable-all: true
disable:
- fieldalignment
- shadow
importas:
no-unaliased: true
alias:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
16 changes: 4 additions & 12 deletions pkg/manager/internal.go
Expand Up @@ -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
Expand All @@ -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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf

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.
Expand Down
2 changes: 1 addition & 1 deletion tools/setup-envtest/store/store.go
Expand Up @@ -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) { //nolint:govet
return fmt.Errorf("unable to finish un-tar-ing the downloaded archive: %w", err)
}
log.V(1).Info("unpacked archive")
Expand Down