$ go version
go version go1.21.0 linux/ppc64le
$ cd ~/golang/plain/go/src/cmd/compile/internal/ssa
$ pwd
/home/boger/golang/plain/go/src/cmd/compile/internal/ssa
$ go version
go: downloading go1.22 (linux/ppc64le)
go: download go1.22 for linux/ppc64le: toolchain not available
$ cd ~/gotests
$ go version
go version go1.21.0 linux/ppc64le
@matthewhughes-uw, this is as expected: go 1.21
was a development version of the language, for which there is no downloadable release (because it is not a specific version). The release version would be go 1.21.0
.
In general if you want to specify a development version in the go
line, you must also give a concrete toolchain
version. So either of these should work:
go 1.21
toolchain go1.21.0
@laboger, the problem you are seeing is similar. go1.21.0
cannot upgrade automatically to a toolchain that supports go 1.22
, because no such toolchain has been released. In order to compile a package in a go 1.22
module, you need to use a development build of the toolchain that supports that language version.
In particular, if you are working within $GOROOT/src
you should be using exactly the toolchain built by make.bash
within that GOROOT — you may need to re-run make.bash
and/or check your $PATH
. 😅
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
label
Aug 25, 2023
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
label
Aug 25, 2023
@matthewhughes-uw, are there specific documentation changes that would have helped you solve or avoid this problem?
I think the main issue was my assumption that, previously I could just specify a language version (per https://go.dev/doc/toolchain#version) i.e. go 1.X
in my go.mod
e.g. go 1.20
but with Go 1.21 I can no longer do this. The docs say:
The version must be a valid Go release version, such as 1.9, 1.14, or 1.21rc1
and within the linked page
The syntax ‘1.N’ is called a “language version”. It denotes the overall family of Go releases implementing that version of the Go language and standard library.
so I guess it wasn't clear to me that a "language version" != a "Go release version" (though it was true for every language version before Go 1.21)
In general if you want to specify a development version in the go line, you must also give a concrete toolchain version. So either of these should work:
🤔 Maybe it's worth documenting something like "If you want to specify a 'language version' in go.mod
you should (must? But again, only true for Go 1.21 at the moment) also specify a toolchain version"?
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
label
Aug 25, 2023
I think the main issue was my assumption that, previously I could just specify a language version (per https://go.dev/doc/toolchain#version) i.e. go 1.X in my go.mod e.g. go 1.20 but with Go 1.21 I can no longer do this.
To add to this: what really happened here that causes a bit of confusion is that the value of go
keyword in go.mod
changed it's format.
Before 1.21 release X.Y.Z
value (1.20.1
) would be invalid so you couldn't put it there.
With 1.21 release you most likely want to put X.Y.Z
there since most user would want to put there a real working version, not a dev release.
To add to confusion X.Y
value technically works, but it may or may not depending on what was released.
So the way I see it we went from never put .0
to always put .0
(0 being point release number).
Having now also toolchain
(which from docs sounds like it's optional) just means that people need to wrap their heads around more complicated set of options to set, as per example from #62278 (comment).
According to [1] as of Go 1.21 we either need to specify the full
toolchain version in the `go` directive or add a `toolchain` directive
with the concrete toolchain version. Opt for the former and make sure
it's kept up to date by renovate bot.
[1] golang/go#62278 (comment)
Signed-off-by: Tobias Klauser <[email protected]>
According to [1] as of Go 1.21 we either need to specify the full
toolchain version in the `go` directive or add a `toolchain` directive
with the concrete toolchain version. Opt for the former and make sure
it's kept up to date by renovate bot.
[1] golang/go#62278 (comment)
Signed-off-by: Tobias Klauser <[email protected]>
Starting with Go version 1.21, the exact minimum Go release version or
the toolchain version must be specified in go.mod (see also
golang/go#62278 (comment)). So,
change the Go version from "1.23" to "1.23.0".
Signed-off-by: hwipl <[email protected]>
Starting with Go version 1.21, the exact minimum Go release version or
the toolchain version must be specified in go.mod (see also
golang/go#62278 (comment)). So,
change the Go version from "1.23" to "1.23.0".
Signed-off-by: hwipl <[email protected]>
go 1.22 is a development version for which there is no downloadable release,
and so 'go' cannot install a proper toolchain for it.
See: golang/go#62278 (comment)
This also uses 1.23.0 as go version instead of 1.23. The latter is
an invalid version as there is no release. Hence, building will
fail. See golang/go#62278.