Description
Note: I think this is a question of: is "go 1.21
" a valid go directive? since there was no 1.21
release, only 1.21.0
, perhaps not
What version of Go are you using (go version
)?
$ go version go version go1.21.0 linux/amd64
Does this issue reproduce with the latest release?
Yes, reproduced on Go 1.21.0
What operating system and processor architecture are you using (go env
)?
go env
Output
GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/root/.cache/go-build' GOENV='/root/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.21.0' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='0' GOMOD='/proj/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build435086183=/tmp/go-build -gno-record-gcc-switches'
What did you do?
Given a basic go.mod
$ cat go.mod
module example.com/foo
go 1.21
Then run:
$ GOTOOLCHAIN="go1.20+auto" go mod tidy
go: downloading go1.21 (linux/amd64)
go: download go1.21 for linux/amd64: toolchain not available
What did you expect to see?
go mod tidy
runs successfully. I guess I expect it would pick go1.21.0
as the toolchain if no toolchain is available as 1.21
What did you see instead?
The error output above with a non-zero exit code
More details
The issue was seen when running dependabot
on a repo with a go 1.21
directive in go.mod
, the GOTOOLCHAIN
above was taken from their usage https://github.com/dependabot/dependabot-core/blob/08ac25ebd773cede0c00be9a98e5bb03b680870b/go_modules/Dockerfile#L34
Running the above command with GODEBUG=http2debug=1
I see it:
- requests
go.dev/dl/mod/golang.org/toolchain/@v/v0.0.1-go1.21.linux-amd64.zip
which returnsLocation: https://go.dev/dl/mod/golang.org/toolchain/@v/v0.0.1-go1.21.linux-amd64.zip
- requesting that URL then returns
location: https://dl.google.com/go/v0.0.1-go1.21.linux-amd64.zip
- requesting that URL gives a 404
Updating the directive to: go 1.21.0
will permit things to run fine.
Update: closed per #62278 (comment)