Skip to content

Run make lint under the toolchain go.mod pins - #54

Merged
ilovecrayons merged 1 commit into
mainfrom
varram/sup-73-make-lint-fails-on-newer-go
Sep 4, 2026
Merged

Run make lint under the toolchain go.mod pins#54
ilovecrayons merged 1 commit into
mainfrom
varram/sup-73-make-lint-fails-on-newer-go

Conversation

@not-varram

Copy link
Copy Markdown
Contributor

Summary

Closes SUP-73. On a machine with a newer Go than go.mod's toolchain line, make lint failed before linting anything:

cannot decode "embed", export data version 4 is greater than maximum supported version 2

golangci-lint v2.4.0 cannot read export data from a newer Go. The lint target now reads the toolchain line (falling back to the go directive) and runs the linter under GOTOOLCHAIN=<that version>, which Go downloads on demand. A go.mod with neither line stops make with a clear error instead of guessing. CI is unchanged: it already reaches the same toolchain through the default GOTOOLCHAIN=auto.

CONTRIBUTING.md notes the pin under Checks and quotes the real error.

Validation

  • make lint passes unmodified on a Go 1.27 host, and under GOTOOLCHAIN=go1.25.13.
  • Six synthetic go.mod shapes checked (toolchain line, no toolchain line, toolchain default, rc versions, no go directive, no go.mod).
  • make fmt-check, make vet, make public-audit, make test-scripts pass.
  • Fresh-context adversarial review: two findings (a fallback to auto that reintroduced the bug, and a comment misstating what setup-go reads) fixed before opening this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_019irxg6aWWKmn2w3QsJR5CJ

golangci-lint cannot decode export data produced by a Go newer than the
one that built it, so on a host whose default Go is ahead of go.mod's
toolchain line `make lint` failed before linting anything with "export
data version 4 is greater than maximum supported version 2".

The lint target now resolves the Go version go.mod pins - the `toolchain`
line when it names one, else the `go` directive, since `toolchain default`
names no version - and sets GOTOOLCHAIN for the linter run. That is the
Go CI lints with too: setup-go installs the `go` directive's version and
the default GOTOOLCHAIN=auto re-execs into the `toolchain` line. Go
downloads the toolchain on demand, so no local setup is needed, and a
go.mod carrying neither version fails loudly rather than falling back to
a value that reproduces the bug.

CI lints through golangci-lint-action rather than this target and is
unchanged.
@ilovecrayons
ilovecrayons merged commit 2a3149b into main Sep 4, 2026
6 checks passed
@not-varram
not-varram deleted the varram/sup-73-make-lint-fails-on-newer-go branch September 4, 2026 04:18
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