Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: improve "toolchain not available" message when patch version is missing #66175

Closed
adonovan opened this issue Mar 7, 2024 · 8 comments
Assignees
Labels
BadErrorMessage Issues related compiler error messages that should be better. FixPending Issues that have a fix which has not yet been reviewed or submitted. GoCommand cmd/go
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Mar 7, 2024

xtools$ GOTOOLCHAIN=go1.22 go run hello.go
go: downloading go1.22 (darwin/arm64)
go: download go1.22 for darwin/arm64: toolchain not available
xtools$ GOTOOLCHAIN=go1.22.0 go run hello.go
Hello, world.

It took me a long while to figure out that the cause of the problem was a missing patch version suffix (.0). Either the go command should pick a reasonable suffix itself, or it should report that I am expected to provide one.

@mknyszek mknyszek added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Mar 8, 2024
@mknyszek mknyszek added this to the Backlog milestone Mar 8, 2024
@mknyszek
Copy link
Contributor

mknyszek commented Mar 8, 2024

@bcmills bcmills added the BadErrorMessage Issues related compiler error messages that should be better. label Mar 11, 2024
@bcmills
Copy link
Contributor

bcmills commented Mar 11, 2024

(CC @samthanawalla)

@ldemailly
Copy link

it's worse in the case of no explicit TOOLCHAIN (if you set a toolchain I think it's reasonable that it'd be fully qualified) but completely baffling when happening indirectly through a go.mod entry that breaks all previous use of go x.y before go 1.21

See details in #62278 (comment)

@haruyama480
Copy link
Contributor

There are several approaches to work.

  1. Specify a patch version in go directive, like go 1.22.0.
  2. Specify a toolchain name in toolchain directive, like toolchain go1.22.0. Note that go1.22 isn't a toolchain name.
  3. Run export GOTOOLCHAIN='go1.22.0+auto' for your environments that are trying to install newer go toolchain.

The Go Version, like1.22, is called 'language version'.

Specifying language version in go directive without toolchain directive will make developers which need to download newer toolchain fail. I hope go command or any document notes that.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/580217 mentions this issue: Require patch in GOTOOLCHAIN or download 1.X.0 otherwise.

@samthanawalla samthanawalla added FixPending Issues that have a fix which has not yet been reviewed or submitted. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 22, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/583797 mentions this issue: [release-branch.go1.21] cmd/go: download 1.X.0 instead of 1.X during toolchain upgrade.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/583915 mentions this issue: [release-branch.go1.22] cmd/go: download 1.X.0 instead of 1.X during toolchain upgrade.

gopherbot pushed a commit that referenced this issue May 10, 2024
…toolchain upgrade.

This CL modifies the download behavior when downloading a toolchain for 1.21+. Previously, Go would attempt to download 1.X when upgrading the toolchain which would cause the download to fail for 1.21+ since 1.X is an invalid toolchain. We will attempt to download 1.X.0 since that's likely what the user intended.

Additionally, we will also now provide a better error message when the
user provides a language version instead of a toolchain version for
1.21+.

For #66175
For #62278

Fixes #67236

Change-Id: I28f894290a19d8e3cd220e9d70aeca8f4447e5a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/580217
Reviewed-by: Michael Matloob <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
(cherry picked from commit 27ed85d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/583915
gopherbot pushed a commit that referenced this issue May 10, 2024
…toolchain upgrade.

This CL modifies the download behavior when downloading a toolchain for 1.21+. Previously, Go would attempt to download 1.X when upgrading the toolchain which would cause the download to fail for 1.21+ since 1.X is an invalid toolchain. We will attempt to download 1.X.0 since that's likely what the user intended.

Additionally, we will also now provide a better error message when the
user provides a language version instead of a toolchain version for
1.21+.

For #66175
For #62278

Fixes #67235

Change-Id: I28f894290a19d8e3cd220e9d70aeca8f4447e5a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/580217
Reviewed-by: Michael Matloob <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
(cherry picked from commit 27ed85d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/583797
ldemailly added a commit to ldemailly/go-scratch that referenced this issue Jun 7, 2024
ldemailly added a commit to ldemailly/go-scratch that referenced this issue Jun 9, 2024
* get pods from context default config

* I hate that horrible toolchain thing... golang/go#66175 (comment)

* improve output a bit and explain that empty == all namespaces

* Add comment for where clientcmd.NewNonInteractiveDeferredLoadingClientConfig is coming from

* simpler version, that also gets 'default' instead of ''

* add flags to override --context, --namespace etc
shuLhan added a commit to shuLhan/rescached that referenced this issue Jul 6, 2024
Seems like the latest Go require the minor version to be explicitly
defined [1][2].

[1] golang/go#65568
[2] golang/go#66175
Omrigan added a commit to neondatabase/autoscaling that referenced this issue Sep 7, 2024
See also golang/go#66175

Otherwise can't build:
  go: download go1.22 for linux/amd64: toolchain not available

Signed-off-by: Oleg Vasilev <[email protected]>
Omrigan added a commit to neondatabase/autoscaling that referenced this issue Sep 7, 2024
See also golang/go#66175

Otherwise can't build:
  go: download go1.22 for linux/amd64: toolchain not available

Signed-off-by: Oleg Vasilev <[email protected]>
Omrigan added a commit to neondatabase/autoscaling that referenced this issue Sep 17, 2024
See also golang/go#66175

Otherwise can't build:
  go: download go1.22 for linux/amd64: toolchain not available

Signed-off-by: Oleg Vasilev <[email protected]>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/621861 mentions this issue: all: go get [email protected]

gopherbot pushed a commit to golang/oscar that referenced this issue Oct 23, 2024
This avoids distracting users who are still using go
without the fix for golang/go#66175.

Change-Id: I8847cc54632c72ef334cfc63d8d560644d9ececc
Reviewed-on: https://go-review.googlesource.com/c/oscar/+/621861
Reviewed-by: Jonathan Amsterdam <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BadErrorMessage Issues related compiler error messages that should be better. FixPending Issues that have a fix which has not yet been reviewed or submitted. GoCommand cmd/go
Projects
None yet
Development

No branches or pull requests

8 participants