Repository navigation
Conversation
go.mod said `go 1.26.9`, which conflates two different things. The `go` directive is the minimum language version the module requires; `toolchain` is which toolchain to build with. Declaring 1.26.9 as the language floor claims this code needs 1.26.9 language features, which it does not. go 1.26.0 toolchain go1.26.9 This matches terraform-provider-zentral, which already declared it this way. Nothing about the build changes: setup-go resolves the toolchain directive, and `go-version-file: go.mod` in build.yml, release.yml and govulncheck.yml continues to install 1.26.9. Verified in containers -- building under golang:1.26.9 works unchanged, and under an older golang:1.25.3 with GOTOOLCHAIN=auto the directive makes Go fetch and switch to 1.26.9 on its own. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Closing: the rationale did not hold up under checking. I framed the go/toolchain split as best practice. The Go documentation supports it specifically for modules that are dependencies of other modules -- a library needing a floor lower than its preferred toolchain (go.dev/doc/toolchain). That is goztl's case, not this one: nothing imports osquery-extension, so the Nor is the split common practice. Of six widely-used Go projects checked -- golang/tools, grpc-go, aws-sdk-go-v2, kubernetes, terraform, prometheus -- none carries a So The toolchain itself is unaffected: main stays on 1.26.9 with govulncheck required. |
Standardises on the
go+toolchainsplit that terraform-provider-zentral already used.What changes
The two directives mean different things and
go 1.26.9conflated them:gois the minimum language version the module requires — a floor, and for consumers of the module, a constraint.toolchainis what actually builds it.Declaring 1.26.9 as the language floor claims the code needs 1.26.9 language features, which it does not.
Nothing about the build changes
setup-goresolves thetoolchaindirective, sogo-version-file: go.modkeeps installing 1.26.9 — verified on terraform-provider-zentral, whose govulncheck run reportsSuccessfully set up Go version 1.26.9from exactly this shape of go.mod.Demonstrated the other half too: in a
golang:1.25.3container withGOTOOLCHAIN=auto, the directive makes Go fetch and switch to 1.26.9 on its own (go version go1.26.9). An older local toolchain now upgrades itself rather than silently building with the wrong one.Verification
Built and vetted in
golang:1.26.9;go mod verifyclean.🤖 Generated with Claude Code