-
Notifications
You must be signed in to change notification settings - Fork 248
Bump Golangci lint to 2.6.1 #4316
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
Draft
thardeck
wants to merge
18
commits into
main
Choose a base branch
from
bump_golangci_lint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
178d343 to
2d2a1d0
Compare
Checks for returning nil, nil which is often a bug * return both a `nil` error and an invalid value: use a sentinel error instead
Finds code returning nil when err is not nil * error is not nil but it returns nil
Ensures proper error wrapping/unwrapping with Go 1.13+ errors * no issues found
Ensures HTTP response bodies are closed * response body must be closed
Detects loop variable capture bugs Issues were fixed bit the linter autofix functionality.
Removes unnecessary type conversions * unnecessary conversion
Propagates context through function calls * Non-inherited new context, use function like context.WithXXX instead * Function should pass the context parameter
Use context-aware functions for HTTP requests and exec commands * net/http.NewRequest must not be called * net/http.Get must not be called * os/exec.Command must not be called * crypto/tls.Dial must not be called
Add t.Helper() calls to test helper functions * test helper function should start from t.Helper() * parameter *testing.T should be the first or after context.Context
Checks key-value pairs for common logger libraries (klog, logr, zap) * Fixed odd number of arguments in logger.Error call - added 'recover' key for the recovery value
Checks usage of github.com/stretchr/testify for best practices * Changed assert.NoError/Error to require.NoError/Error for error assertions in tests * Error assertions should use require to stop test execution on failure
Reports ill-formed or insufficient nolint directives * Fixed nolint directive format - removed leading space (e.g., '// nolint:' -> '//nolint:') * Fixed gosec nolint directives to use proper format (//nolint:gosec //) * Removed unused nolint directives for gosec in e2e/benchmarks (gosec excluded for these paths) * Removed unused funlen nolint directives in test files (funlen excluded for *_test.go files) * Added proper unparam nolint directive where actually needed
2d2a1d0 to
ded93c3
Compare
ded93c3 to
cd7a933
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix newly reported issues.
Also add additional potentially useful linters, one per commit with its according fixes.