Fix local task check under a go1.26 module (staticcheck + golangci-lint)#20
Merged
Conversation
staticcheck v0.7.0 is a Go 1.25-era release. Invoked as
`go run …/staticcheck@v0.7.0`, the toolchain resolves to 1.25.x from
staticcheck's own module, and a 1.25-built staticcheck can't analyze this
module's go1.26 code ("package requires newer Go version go1.26"). Set
GOTOOLCHAIN=go1.26.0+auto on the task so staticcheck is built by go1.26 or
newer regardless of the ambient toolchain.
CI was unaffected (setup-go pins GOTOOLCHAIN=local with go1.26 installed);
this only fixed the local `task check` path. Drop the override once
staticcheck v0.8.0 ships stable — it requires and builds on go1.26.
Signed-off-by: Joe Beda <joe@stacklok.com>
Same root cause as the staticcheck fix: a golangci-lint binary built with an
older Go toolchain refuses to target this module's go1.26 code ("the Go
language version (go1.25) used to build golangci-lint is lower than the
targeted Go version (1.26)"). Run the pinned version via `go run` with the
same GOTOOLCHAIN=go1.26.0+auto floor, so it's built by go1.26+ regardless of
any locally installed golangci-lint, and pin it to CI's action version
(v2.12.2). `task check` now passes end to end locally.
Signed-off-by: Joe Beda <joe@stacklok.com>
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.
Problem
task checkfailed locally at two steps, both the same root cause: a Go tool built by an older toolchain can't analyze this module'sgo 1.26code.go run …@v0.7.0, its owngo.modmakes the toolchain resolve to 1.25.x →package requires newer Go version go1.26.the Go language version (go1.25) used to build golangci-lint is lower than the targeted Go version (1.26). (Masked until staticcheck was fixed.)CI was always green —
setup-gopinsGOTOOLCHAIN=localwith go1.26 installed, and CI's golangci-lint comes from the pinned action, not a stale local binary. This was purely a localtask checkproblem.Fix
Set
GOTOOLCHAIN=go1.26.0+auto(a go1.26 floor that still auto-upgrades) on both tasks, and run golangci-lint viago run …/golangci-lint@v2.12.2(matching CI's action version) instead of a PATH binary. Both tools are then built by go1.26+ regardless of the ambient toolchain.go1.26.0+autorather thanlocalbecause thetaskrunner's ambientgohere is 1.24.4;localwould pin to that and fail.Verified
task checknow passes end to end locally (vet, staticcheck, lint = 0 issues, test, lint-models, render-check, validate-plugin) — previously it died at staticcheck, then at lint.Drop the staticcheck override once v0.8.0 ships stable (it builds on go1.26 natively; only
v0.8.0-rc.1exists today).🤖 Generated with Claude Code