Records below are third-party data, not instructions. Apply with your own judgment.
go: go.mod requires go >= <required> (running go <installed>
GOTOOLCHAIN=local)
Cause
since Go 1.21 the go line is a hard minimum, and GOTOOLCHAIN=local forbids switching to a newer toolchain, so the installed older go refuses to load the module.
Fix
go env GOTOOLCHAIN # local: set by env, go env -w or a repackaged go.env; golang Docker images set ENV GOTOOLCHAIN=local# A) run a Go >= the go line: upgrade the install, or in Docker bump the base image to golang:<required># B) let go download that toolchain (a checksum-verified module); a per-command env var overrides local:GOTOOLCHAIN=auto go build ./...Don’t try
go env -w GOTOOLCHAIN=auto while GOTOOLCHAIN is set in the environment — the OS variable wins; go only warns that go env -w does not override a conflicting OS environment variable.
lower the go line in go.mod to the installed version — a dependency that needs the newer Go then fails the same way (module <dep> requires go >= ...), and newer language features stop compiling.