Repository navigation
Backport bugfixes from golangci-lint v2.13.2 - #7
Merged
Merged
Conversation
Backports golangci-lint#6756. Fixes a panic when a closure parameter uses a type parameter from the enclosing function or method: the zero-size skip was gated on whether the function itself was generic, so Sizeof() was called on a type parameter. Packages that previously crashed now lint normally, which may surface new unparam findings in generic code. The fix also reframes containsTypeParam to walk a named type's underlying rather than its type arguments, so parameters of zero-sized generic types with phantom type parameters are no longer reported — matching unparam's own zero-size skip rule. Claude-Session: https://claude.ai/code/session_01M4TJMAdr2ZUYLibC2kHAtt
Backports golangci-lint#6748. Fixes two SA4023 false positives that
staticcheck introduced in 2026.2 (v0.8.0), the version gopherlint v1.27.0
ships, so this is a regression fix against our own current release.
- Unconstrained generics are no longer treated as never-nil (#1736).
IsPointerLike is renamed to MaybePointerLike and now returns true for
type sets without structural restrictions.
- SA4023 now requires the inner value to be possibly nil, so it only flags
never-nil interfaces that may hold a typed nil. Defensive comparisons
such as errors.New("") == nil are no longer reported (#1737).
The remaining call sites in nilness, SA5009, SA5011, and SA6002 are
mechanical renames. Verified against old and new binaries: the
errors.New("") == nil comparison is flagged by v0.8.0 and clean under
v0.8.1.
Claude-Session: https://claude.ai/code/session_01M4TJMAdr2ZUYLibC2kHAtt
Backports golangci-lint#6762. Cache keys and cached issue positions embedded absolute file paths, so the same module content checked out at a different path — CI runners, containers, renamed worktrees — always missed the cache and re-analyzed from scratch. Paths are now stored relative to the module directory: computePkgHash keys files by module path, computeGoModSalt hashes go.mod under a fixed name rather than its location, and cached issue positions are stored relative and rehydrated to absolute on load. The salt gains a constant "golangci-lint-cache/v2" to invalidate entries written before this change, which hold absolute paths and would rehydrate incorrectly. The literal is kept verbatim: it is appended to every salt, so it namespaces nothing between gopherlint and golangci-lint — the two are already disjoint via computeBinarySalt — and diverging from upstream here would only create a merge conflict point. Verified with pre- and post-fix binaries on identical module content at two paths: the old binary misses at the second path, the new one hits, and issue positions are reported identically on a cross-path cache hit. Claude-Session: https://claude.ai/code/session_01M4TJMAdr2ZUYLibC2kHAtt
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.
Triages all ten commits in golangci-lint's
v2.13.1..v2.13.2range and backports the three that fit the fork's bugfix-only charter.Backported
Cache reuse across module locations (golangci-lint#6762)
Cache keys and cached issue positions embedded absolute file paths, so identical module content checked out at a different path — CI runners, containers, renamed worktrees — always missed the cache. Paths are now stored relative to the module directory.
Verified end-to-end with pre- and post-fix binaries on the same content at two paths:
Issue positions rehydrate correctly: a cross-path cache hit reports
sub/bar.go:6:17identically to the cold run.This release invalidates existing cache entries once, by design — entries written before the change hold absolute paths and would rehydrate incorrectly.
staticcheck v0.8.0 → v0.8.1 (golangci-lint#6748)
Fixes two SA4023 false positives that staticcheck introduced in 2026.2 (v0.8.0) — the version gopherlint v1.27.0 ships — so this is a regression fix against our own current release.
errors.New("") == nilConfirmed against both binaries:
SA4023: this comparison is never trueunder v0.8.0, clean under v0.8.1.unparam → 2fa3d841b0c8 (golangci-lint#6756)
Fixes a panic when a closure parameter uses a type parameter from the enclosing function or method — the zero-size skip was gated on whether the function itself was generic, so
Sizeof()was called on a type parameter.Two behavior notes, both documented in the changelog:
unparamfindings may appear in generic code.containsTypeParamto walk a named type's underlying rather than its type arguments, so parameters of zero-sized generic types with phantom type parameters are no longer reported — matchingunparam's own zero-size skip rule.Deliberately excluded
linters-settings.canonicalheaderblock and changes default findings. Feature, not a fix; the fork's only substantive commit isfeat: configurable headers.types.TypeString, which can change reported type strings.scripts/, two docs commits — upstream CI and website only.Verification
golangci-lint run ./...→ 0 issues andgo test ./...→ all passing, before each commit.Upstream
mastercurrently has no commits after v2.13.2, so this exhausts the available backports.https://claude.ai/code/session_01M4TJMAdr2ZUYLibC2kHAtt