Skip to content

Bump golangci-lint from v2.5.0 to v2.11.4#5066

Merged
pietern merged 1 commit intomainfrom
enforce-go-fix
Apr 22, 2026
Merged

Bump golangci-lint from v2.5.0 to v2.11.4#5066
pietern merged 1 commit intomainfrom
enforce-go-fix

Conversation

@pietern
Copy link
Copy Markdown
Contributor

@pietern pietern commented Apr 22, 2026

Changes

Upgrades the pinned golangci-lint version via tools/go.{mod,sum}.

The bump pulls in newer staticcheck and perfsprint rules that surface 28 pre-existing issues. They are resolved in this same PR so CI goes green:

  • 9 × perfsprint concat-loop — hand-rewritten using strings.Builder (or []byte accumulators in test code) with sensible variable names, instead of the auto-fix's mechanical <name>Sb<lineno> output.
  • 17 × staticcheck QF1012 (WriteString(fmt.Sprintf(...))fmt.Fprintf(&sb, ...)) — applied via golangci-lint run --fix.
  • 2 × intentional fixture sites silenced with //nolint:staticcheck: a parser.ParseDir import-only scan (SA1019, deprecated in Go 1.25) and a deliberately malformed json:"-,omitempty" tag (SA5008) used to exercise structwalk tag handling.

Why

The main motivation for the bump is access to the modernize linter, which wraps gopls's modernize analyzer suite (stringsbuilder, reflecttypefor, omitzero, mapsloop, etc.) and became available in golangci-lint v2.6.0. It's the closest in-tree equivalent to Go 1.26's go fix ./... modernizers while we're still on the Go 1.25 toolchain.

Enabling modernize and applying its rewrites is intentionally not part of this PR — it will ship as a follow-up so this change stays local and small (just the bump + the lint-rule fallout it forces).

Test plan

  • make build — passes
  • make lint / ./tools/golangci-lint run ./... — 0 issues
  • go test on all touched packages — passing
  • CI green

This pull request and its description were written by Isaac.

## Changes
Upgrades the pinned golangci-lint version via `tools/go.{mod,sum}`.

The bump pulls in newer staticcheck and perfsprint rules that surface
28 pre-existing issues. They are resolved in this same PR so CI goes
green:

- 9 × `perfsprint concat-loop` — hand-rewritten using `strings.Builder`
  (or `[]byte` accumulators in test code) with sensible variable names,
  instead of the auto-fix's mechanical `<name>Sb<lineno>` output.
- 17 × `staticcheck QF1012` (`WriteString(fmt.Sprintf(...))` →
  `fmt.Fprintf(&sb, ...)`) — applied via `golangci-lint run --fix`.
- 2 × intentional fixture sites silenced with `//nolint:staticcheck`:
  a `parser.ParseDir` import-only scan (SA1019, deprecated in Go 1.25)
  and a deliberately malformed `json:"-,omitempty"` tag (SA5008) used
  to exercise structwalk tag handling.

## Why
The main motivation for the bump is access to the `modernize` linter,
which wraps gopls's modernize analyzer suite (`stringsbuilder`,
`reflecttypefor`, `omitzero`, `mapsloop`, etc.) and became available in
golangci-lint v2.6.0. It's the closest in-tree equivalent to Go 1.26's
`go fix ./...` modernizers while we're still on the Go 1.25 toolchain.

- golangci-lint `modernize` linter:
  https://golangci-lint.run/usage/linters/#modernize
- Upstream analyzer suite:
  https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize

Enabling `modernize` and applying its rewrites is intentionally NOT
part of this PR — it will ship as a follow-up so this change stays
local and small (just the bump + the lint-rule fallout it forces).

Co-authored-by: Isaac
@pietern pietern disabled auto-merge April 22, 2026 15:08
@pietern pietern enabled auto-merge April 22, 2026 15:08
@pietern pietern added this pull request to the merge queue Apr 22, 2026
Merged via the queue into main with commit 6849eff Apr 22, 2026
31 checks passed
@pietern pietern deleted the enforce-go-fix branch April 22, 2026 15:42
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.

4 participants