Skip to content

Conversation

@thardeck
Copy link
Collaborator

@thardeck thardeck commented Nov 10, 2025

fix newly reported issues.
Also add additional potentially useful linters, one per commit with its according fixes.

@thardeck thardeck self-assigned this Nov 10, 2025
@thardeck thardeck requested a review from a team as a code owner November 10, 2025 15:06
@thardeck thardeck added this to Fleet Nov 10, 2025
@thardeck thardeck moved this to 👀 In review in Fleet Nov 10, 2025
@thardeck thardeck moved this from 👀 In review to 🏗 In progress in Fleet Nov 11, 2025
@thardeck thardeck marked this pull request as draft November 11, 2025 05:30
@thardeck thardeck force-pushed the bump_golangci_lint branch 5 times, most recently from 178d343 to 2d2a1d0 Compare November 12, 2025 09:29
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants