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: mod tidy reports toolchain not available with 'go 1.21' #62278
Comments
how did you end up with |
I can't remember exactly, but I think it was rather manual like: |
I am seeing this problem on linux/ppc64le.
|
@matthewhughes-uw, this is as expected: In general if you want to specify a development version in the go 1.21.0 or go 1.21
toolchain go1.21.0 |
@laboger, the problem you are seeing is similar. In particular, if you are working within |
As far as I can tell this is all working as designed. @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.
and within the linked page
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)
🤔 Maybe it's worth documenting something like "If you want to specify a 'language version' in |
S. golang/go#62278 (comment) for details
Set golang version to `v1.21.0`, s. golang/go#62278 (comment)
To add to this: what really happened here that causes a bit of confusion is that the value of Before 1.21 release With 1.21 release you most likely want to put So the way I see it we went from Having now also |
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 <tobias@cilium.io>
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 <tobias@cilium.io>
After further consideration and discussion with @hyangah @rsc and @samthanawalla we've decided to change the behavior so that if the go.mod lists go 1.X and the current go version is less than that version, we'll attempt to download go 1.X.0 if it exists. Many of our users are used to manually writing go 1.X in their go.mod files so it seems reasonable to allow that to continue to have a reasonable meaning. Though once this is fixed and released in 1.23 the fix will only be available to users with local toolchains of 1.23 and later. |
See the following for more details: * golang/go#65568 (comment) * golang/go#62278 (comment)
See: golang/go#62278 (comment) I have no idea why this was working in CI.
See: golang/go#62278 (comment) I have no idea why this was working in CI.
**Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> We currently use `go 1.21` in all go.mod files, this PR changes all go.mod files to include the minor version by using `go 1.21.0`. It seems that using the minor version is recommended by the Go project: golang/go#62278. One of the dependencies in collector-contrib also uses `go 1.21.0`, so this will need to be updated eventually anyways: https://github.com/cilium/ebpf/blob/main/go.mod#L3. **Link to tracking Issue:** <Issue number if applicable> **Testing:** <Describe what testing was performed and which tests were added.> **Documentation:** <Describe the documentation added.> --------- Co-authored-by: Antoine Toulme <antoine@toulme.name>
Thanks for the discussion! I am wondering about a corner case. If this has already been discussed, please disregard. Can we build a module having |
This comment was marked as resolved.
This comment was marked as resolved.
Change https://go.dev/cl/580217 mentions this issue: |
@haruyama480 We will use So in the case of With this change, in the case of Hopefully that addresses your question. |
I understand
It seems to work well. |
why make 1.X mean 1.X.0 instead of the more useful 1.X.p where p is the latest patch for 1.X |
@haruyama480 @ldemailly |
## Description <!-- What code changes are made? What problem does this PR addresses, or what feature this PR adds? --> My go can't download toolchain: ```bash go env go: downloading go1.22 (linux/amd64) go: download go1.22 for linux/amd64: toolchain not available ``` Here is the answer why: golang/go#62278 (comment) <!-- Usage: `Resolves #<issue number>`, or `Resolves <link to the issue>`. If PR is about `failing-tests`, please post the related tests in a comment and do not use `Resolves` -->
Note: I think this is a question of: is "
go 1.21
" a valid go directive? since there was no1.21
release, only1.21.0
, perhaps notWhat version of Go are you using (
go version
)?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
OutputWhat did you do?
Given a basic
go.mod
Then run:
What did you expect to see?
go mod tidy
runs successfully. I guess I expect it would pickgo1.21.0
as the toolchain if no toolchain is available as1.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 ago 1.21
directive ingo.mod
, theGOTOOLCHAIN
above was taken from their usage https://github.com/dependabot/dependabot-core/blob/08ac25ebd773cede0c00be9a98e5bb03b680870b/go_modules/Dockerfile#L34Running the above command with
GODEBUG=http2debug=1
I see it: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
location: https://dl.google.com/go/v0.0.1-go1.21.linux-amd64.zip
Updating the directive to:
go 1.21.0
will permit things to run fine.The text was updated successfully, but these errors were encountered: