Skip to content

ci: bump golangci-lint to v2.13 for Go 1.27 - #508

Merged
tomasaschan merged 1 commit into
spf13:masterfrom
hdimer:fix/golangci-lint-go127
Sep 3, 2026
Merged

ci: bump golangci-lint to v2.13 for Go 1.27#508
tomasaschan merged 1 commit into
spf13:masterfrom
hdimer:fix/golangci-lint-go127

Conversation

@hdimer

@hdimer hdimer commented Sep 1, 2026

Copy link
Copy Markdown

Taking up @tomasaschan's "PR welcome" from #500.

The problem

stable now resolves to Go 1.27, and golangci-lint v2.7 is built with an older Go, so it cannot read 1.27's export data:

export data version 4 is greater than maximum supported version 2

Every stdlib import then fails to resolve and the run collapses into a typecheck cascade — including errors.go:44:1: missing return for a function whose last statement is panic(...). Nothing in the module is actually wrong; the Test jobs stay green across all six matrix entries while Lint goes red, which makes unrelated PRs look broken.

The change

  • v2.7v2.13. v2.13.0 added Go 1.27 support (go1.27 support golangci/golangci-lint#6642) and v2.13.2 is built with go1.27.0.
  • The bump also enables govet's new inline analyzer, which flags reflect.Ptr in golangflag.go and text.go (3 sites) in favour of reflect.Pointer. reflect.Pointer landed in Go 1.18 and go.mod still declares go 1.12 — which CI genuinely exercises — so I disabled the analyzer instead of touching the call sites. Worth reverting whenever the floor moves past 1.18; I left a comment saying so.

I kept this to the version bump. #451 already proposes restructuring the matrix, and I did not want to collide with it.

Verification

Local, golangci-lint 2.13.2:

  • golangci-lint config verify → exit 0
  • golangci-lint run → exit 0, 0 issues (on the same tree, v2.13 without the govet change reports the 3 reflect.Ptr findings)
  • go test -race ./... → ok

I could not reproduce the original failure locally — it needs a Go 1.27 toolchain, which is exactly the condition CI is now in — so the export-data diagnosis comes from the CI logs on #500 and #506 rather than a local repro.

golangci-lint v2.7 is built with an older Go and cannot read Go 1.27's
export data:

    export data version 4 is greater than maximum supported version 2

Now that `stable` resolves to 1.27, every stdlib import fails to resolve and
the run collapses into a typecheck cascade — including an `errors.go:44:1:
missing return` for a function whose last statement is `panic(...)`. The Lint
job is red on unrelated PRs as a result.

v2.13.0 added Go 1.27 support and v2.13.2 is built with go1.27.0.

The bump also turns on govet's new `inline` analyzer, which suggests
`reflect.Pointer` over `reflect.Ptr` in three places. `reflect.Pointer` needs
Go 1.18 and this module still builds and tests on Go 1.12, so the analyzer is
disabled rather than the call sites changed. Worth revisiting whenever the
floor moves past 1.18.

Verified with golangci-lint 2.13.2: `config verify` and `run` both exit 0,
0 issues; `go test -race ./...` passes.

@tomasaschan tomasaschan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@hdimer

hdimer commented Sep 2, 2026

Copy link
Copy Markdown
Author

Happy to help. Ping me if the linter flags anything new once it's running on v2.13.

@tomasaschan
tomasaschan merged commit d19b086 into spf13:master Sep 3, 2026
7 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.

2 participants