Skip to content

Backport bugfixes from golangci-lint v2.13.2 - #7

Merged
flimzy merged 3 commits into
mainfrom
fixrelease
Aug 31, 2026
Merged

flimzy merged 3 commits into
mainfrom
fixrelease

Conversation

@flimzy

@flimzy flimzy commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Triages all ten commits in golangci-lint's v2.13.1..v2.13.2 range 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:

A (cold) A again B (different path)
before miss hit miss
after miss hit hit

Issue positions rehydrate correctly: a cross-path cache hit reports sub/bar.go:6:17 identically 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.

  • Unconstrained generics are no longer treated as never-nil (#1736)
  • Comparisons not involving typed nils are no longer flagged (#1737), e.g. errors.New("") == nil

Confirmed against both binaries: SA4023: this comparison is never true under 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:

  • Packages that previously crashed now lint normally, so new unparam findings may appear 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.

Deliberately excluded

  • canonicalheader → golangci fork (#6761) — adds a new linters-settings.canonicalheader block and changes default findings. Feature, not a fix; the fork's only substantive commit is feat: configurable headers.
  • iface v1.5.0 → v1.5.1 (#6749) — no bugfixes. Test rewrites plus a refactor of receiver-type formatting from AST reconstruction to types.TypeString, which can change reported type strings.
  • docker/setup-buildx-action, testify in scripts/, two docs commits — upstream CI and website only.

Verification

golangci-lint run ./... → 0 issues and go test ./... → all passing, before each commit.

Upstream master currently has no commits after v2.13.2, so this exhausts the available backports.

https://claude.ai/code/session_01M4TJMAdr2ZUYLibC2kHAtt

flimzy added 3 commits August 31, 2026 13:17
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
@flimzy
flimzy merged commit 903c16b into main Aug 31, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant