Run make lint under the toolchain go.mod pins - #54
Merged
Conversation
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.
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.
Summary
Closes SUP-73. On a machine with a newer Go than
go.mod's toolchain line,make lintfailed before linting anything:golangci-lint v2.4.0 cannot read export data from a newer Go. The
linttarget now reads thetoolchainline (falling back to thegodirective) and runs the linter underGOTOOLCHAIN=<that version>, which Go downloads on demand. Ago.modwith neither line stops make with a clear error instead of guessing. CI is unchanged: it already reaches the same toolchain through the defaultGOTOOLCHAIN=auto.CONTRIBUTING.md notes the pin under Checks and quotes the real error.
Validation
make lintpasses unmodified on a Go 1.27 host, and underGOTOOLCHAIN=go1.25.13.go.modshapes checked (toolchain line, no toolchain line,toolchain default, rc versions, nogodirective, no go.mod).make fmt-check,make vet,make public-audit,make test-scriptspass.autothat 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