Skip to content

ci: update golangci-lint for compatibility with go1.27 - #815

Open
dangowrt wants to merge 2 commits into
opencontainers:masterfrom
dangowrt:ci-golangci-lint-go1.27
Open

dangowrt wants to merge 2 commits into
opencontainers:masterfrom
dangowrt:ci-golangci-lint-go1.27

Conversation

@dangowrt

Copy link
Copy Markdown
Contributor

The lint job has been failing on every pull request since setup-go's stable moved to Go 1.27, in the same way it failed for go1.26 before ce94ed3 bumped the pin. golangci-lint v2.9.0 is built with go1.26 and cannot read the export data the newer toolchain writes, so the type checker bails out before any linter runs and the job reports could not load export data ... export data version 4 is greater than maximum supported version 2 against files that the pull request under test never touched. v2.13 is the first series built with go1.27.

Bumping the pin on its own is not enough, which is why this is two commits. A linter that can actually run finds four pre-existing issues that the broken one never reached: two from govet, which wants reflect.Pointer rather than the old reflect.Ptr spelling, and two from staticcheck about the deprecated Hooks.Prestart in a test table, annotated the way the non-test use of the same field in checkEventHooks already is. The first commit fixes those, the second moves the pin, so that the tree is clean at the point the new linter starts being used.

Both directions were checked locally against go1.27.1, the toolchain the runner installs, using the release binaries the action downloads rather than a locally built linter, since the whole problem is which Go the linter binary was built with:

tree v2.9.0, the current pin v2.13.2, the proposed pin
master, unchanged fails, Go version mismatch fails, the 4 issues above
with the first commit fails, Go version mismatch passes, exit 0

So the pin bump alone would leave the job red on the four issues, the source fixes alone would leave it red on the mismatch, and the two together make it green. v2.13.0 and v2.13.2 report the same four issues on the unchanged tree, so this is a property of the series rather than of one patch release, and the pin follows the existing style of naming the minor series rather than an exact patch.

Locally the mismatch shows up either as the export data version errors the CI log carries or as panic: file requires newer Go version go1.27 (application built with go1.26), which is the same wording the previous bump quoted, one Go release on. Both are the same cause and both were observed here.

A golangci-lint built against Go 1.27 reports four issues on the tree
that the currently pinned version never reaches, because it aborts on a
typecheck error before any linter runs.

Two are govet telling us reflect.Ptr is the old spelling of
reflect.Pointer. Two are staticcheck on the deprecated Hooks.Prestart in
a test table, annotated the way the non-test use of the same field in
checkEventHooks already is.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
ci started failing once setup-go's "stable" moved to Go 1.27, in the same
way it did for go1.26:

    panic: file requires newer Go version go1.27 (application built with go1.26)

golangci-lint v2.9.0 is built with go1.26 and cannot read the export data
the newer toolchain writes, so every linter aborts before it runs and the
job reports typecheck errors against files no change has touched. v2.13
is the first series built with go1.27.

Verified against go1.27.1 with the release binaries the action installs:
v2.9.0 fails on this tree with and without the preceding commit, v2.13.2
passes with it and reports only the four issues that commit fixes
without it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
@dangowrt
dangowrt requested a review from a team as a code owner September 21, 2026 11:13
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