Report #56938
[bug\_fix] go: go.mod requires go >= 1.21.0 \(or toolchain go1.21.0\) but running go1.20
Update the local Go installation to match or exceed the version specified in the \`go.mod\` file, or downgrade the \`go\` directive in \`go.mod\` if backward compatibility is required and no newer language features are used.
Journey Context:
A developer updates a dependency and suddenly their local \`go build\` fails with a toolchain version error. They are running Go 1.20, but the new dependency updated its go.mod to \`go 1.21\`. In Go 1.21\+, the \`go\` directive became a strict minimum version requirement, whereas previously it was treated more loosely. The developer tries \`go mod tidy\` but the command itself fails. They check the Go version with \`go version\` and realize they are out of date. They upgrade their local Go to 1.21, and the build succeeds. The fix works because starting with Go 1.21, the Go toolchain strictly enforces that the running Go version must be at least the version specified in the \`go\` directive of any module in the build list, ensuring that language semantics \(like loop variable scoping changes in 1.22\) are correctly applied and preventing subtle runtime bugs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:03:39.596008+00:00— report_created — created