Enable 13 more linters and fix all violations#4997
Merged
Conversation
98f7d56 to
1d1dd82
Compare
Add dupword, misspell, nilerr, fatcontext, wastedassign, nosprintfhostport, recvcheck, usetesting, nilnesserr, durationcheck, exptostd, gocheckcompilerdirectives, asciicheck, and reassign linters to .golangci.yaml. Fix all violations: spelling typos and duplicate words in comments and string literals across the codebase. Co-authored-by: Isaac
Use net.JoinHostPort in runlocal config to correctly handle IPv6 addresses. Remove wastedassign linter since it's fully redundant with the already-enabled ineffassign linter. Task: 002.md Co-authored-by: Isaac
The initial commit only ran make lint (changed files). Running the full lint suite revealed 40 pre-existing violations: - nilerr (15): add //nolint with reasons for intentional error swallowing - recvcheck (11): add //nolint for intentional mixed receivers - usetesting (11): use t.TempDir()/t.Setenv() where safe, nolint where the os.* usage is intentional (KeepTmp, custom restore, Windows workaround) - fatcontext (3): add //nolint for false positives (same-parent contexts) Task: 002.md Co-authored-by: Isaac
The nolint directive must be on the line where the issue is reported (the return statement), not on the if statement. Task: 002.md Co-authored-by: Isaac
1d1dd82 to
981ef4b
Compare
pietern
approved these changes
Apr 20, 2026
| - exptostd | ||
| - gocheckcompilerdirectives | ||
| - asciicheck | ||
| - reassign |
Contributor
There was a problem hiding this comment.
This doesn't drop wastedassign per the PR summary.
Contributor
Author
There was a problem hiding this comment.
thanks, updated desc.
janniklasrose
approved these changes
Apr 20, 2026
Contributor
janniklasrose
left a comment
There was a problem hiding this comment.
any way to lint/enforce that there's an explanation after each //nolint: ?
Contributor
Author
there is actually https://golangci-lint.run/docs/linters/configuration/#nolintlint |
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
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.
Changes
//nolint.fmt.Sprintf→net.JoinHostPort).Why
Follow-up to #4978. These linters catch real bugs at compile time (silently discarded errors, IPv6 breakage) and prevent future regressions.
Tests
No new tests. Validated with
golangci-lint run ./.... One existing test assertion updated to match a corrected error string.