cmd/go: GOTOOLCHAIN=version+auto doesn't use the named version in go install #69051
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go1.21.13 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I believe this reproduces with more recent Go versions as well, but since the bug is about upgrading Go toolchain versions it's easier to demonstrate with an older version.
Here's what happens when I use the go command bundled with 1.21.13:
Here's what happens when I use the go command bundled with 1.23.0:
What did you see happen?
With
GOTOOLCHAIN=go1.23.0+auto
, Go 1.21.13 built the binary with Go 1.22.6.What did you expect to see?
I would expect both invocations to build staticcheck using Go 1.23.0.
honnef.co/go/tools/cmd/staticcheck@2024.1.1
hasgo 1.22.1
in itsgo.mod
. So it makes sense that I've I'm using Go 1.21.13, if I ranGOTOOLCHAIN=auto go install honnef.co/go/tools/cmd/staticcheck@2024.1.1
, it would use Go 1.22.6 since that's the latest patch release of the previous Go version and that's the minimum version of the three options documented at https://go.dev/doc/toolchain#switch.However, as documented at https://go.dev/doc/toolchain#intro, the
<name>+auto
form of theGOTOOLCHAIN
var essentially tells the Go tool to use the maximum of<name>
and whatever Go versionauto
would use:As far as I can tell,
go install
is entirely ignoring the<name>
part of<name>+auto
and just behaving the same as if I'd usedGOTOOLCHAIN=auto
.The text was updated successfully, but these errors were encountered: