-
Notifications
You must be signed in to change notification settings - Fork 1.6k
✨Update golangci-lint to v2.0.2 and adjust configuration #4752
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
k8s-ci-robot
merged 1 commit into
kubernetes-sigs:master
from
dongjiang1989:update-golangci-lint-v2
Apr 8, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,106 @@ | ||
version: "2" | ||
run: | ||
timeout: 5m | ||
allow-parallel-runners: true | ||
|
||
issues: | ||
# don't skip warning about doc comments | ||
# don't exclude the default set of lint | ||
exclude-use-default: false | ||
# restore some of the defaults | ||
# (fill in the rest as needed) | ||
exclude-rules: | ||
- linters: [gosec] | ||
path: "test/e2e/*" | ||
- path: "hack/docs/*" | ||
linters: | ||
- lll | ||
- gosec | ||
|
||
linters-settings: | ||
ginkgolinter: | ||
forbid-focus-container: true | ||
forbid-spec-pollution: true | ||
govet: | ||
enable-all: true | ||
disable: | ||
- fieldalignment | ||
nolintlint: | ||
allow-unused: false | ||
revive: | ||
rules: | ||
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration | ||
- name: blank-imports | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: dot-imports | ||
arguments: | ||
# dot import should be ONLY allowed for ginkgo testing packages | ||
- allowedPackages: | ||
- "github.com/onsi/ginkgo/v2" | ||
- "github.com/onsi/gomega" | ||
- name: error-return | ||
- name: error-strings | ||
- name: error-naming | ||
- name: exported | ||
- name: if-return | ||
- name: import-shadowing | ||
- name: increment-decrement | ||
- name: var-naming | ||
- name: var-declaration | ||
- name: package-comments | ||
disabled: true # TODO: Investigate if it should be enabled. Disabled for now due to many findings. | ||
- name: range | ||
- name: receiver-naming | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: indent-error-flow | ||
- name: errorf | ||
- name: empty-block | ||
- name: superfluous-else | ||
- name: unused-parameter | ||
- name: unreachable-code | ||
- name: redefines-builtin-id | ||
# | ||
# Rules in addition to the recommended configuration above. | ||
# | ||
- name: bool-literal-in-expr | ||
- name: constant-logical-expr | ||
- name: comment-spacings | ||
linters: | ||
disable-all: true | ||
default: none | ||
enable: | ||
- asciicheck | ||
- bidichk | ||
- copyloopvar | ||
- dupl | ||
- errcheck | ||
- copyloopvar | ||
- ginkgolinter | ||
- goconst | ||
- gocyclo | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nolintlint | ||
- nakedret | ||
- nolintlint | ||
- prealloc | ||
- revive | ||
- staticcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- whitespace | ||
|
||
settings: | ||
ginkgolinter: | ||
forbid-focus-container: true | ||
forbid-spec-pollution: true | ||
govet: | ||
disable: | ||
- fieldalignment | ||
enable-all: true | ||
nolintlint: | ||
allow-unused: false | ||
revive: | ||
rules: | ||
- name: blank-imports | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: dot-imports | ||
arguments: | ||
- allowedPackages: | ||
- github.com/onsi/ginkgo/v2 | ||
- github.com/onsi/gomega | ||
- name: error-return | ||
- name: error-strings | ||
- name: error-naming | ||
- name: exported | ||
- name: if-return | ||
- name: import-shadowing | ||
- name: increment-decrement | ||
- name: var-naming | ||
- name: var-declaration | ||
- name: package-comments | ||
disabled: true | ||
- name: range | ||
- name: receiver-naming | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: indent-error-flow | ||
- name: errorf | ||
- name: empty-block | ||
- name: superfluous-else | ||
- name: unused-parameter | ||
- name: unreachable-code | ||
- name: redefines-builtin-id | ||
- name: bool-literal-in-expr | ||
- name: constant-logical-expr | ||
- name: comment-spacings | ||
exclusions: | ||
generated: lax | ||
rules: | ||
- linters: | ||
- gosec | ||
path: test/e2e/* | ||
- linters: | ||
- gosec | ||
- lll | ||
path: hack/docs/* | ||
- linters: | ||
- staticcheck | ||
text: "ST1008:" | ||
- linters: | ||
- staticcheck | ||
text: "ST1001:" | ||
- linters: | ||
- revive | ||
text: 'should have comment or be unexported' | ||
paths: | ||
- third_party$ | ||
- builtin$ | ||
- examples$ | ||
formatters: | ||
enable: | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
exclusions: | ||
generated: lax | ||
paths: | ||
- third_party$ | ||
- builtin$ | ||
- examples$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.