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

Open
adonovan opened this issue Mar 7, 2024 · 4 comments
Assignees
Labels
BadErrorMessage Issues related compiler error messages that should be better. GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
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.

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. GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants