Use correct go directive in go.mod file #5720
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The version provided in the go directive must be a valid Go version. go1.21 refers to a development version of Go, not a released version. Prior to 1.21, 1.X was actually the first released version for Go language version 1.X. Starting with 1.21, the first released version is 1.X.0, and the go directive in go.mod should correspond to a valid toolchain version (unless a toolchain directive is also present).
One way to reproduce the issue is to run:
GOTOOLCHAIN="go1.20+auto" go version
When using the
go 1.21
directive, the above command will fail as go will try to download toolchain 1.21, which does not exist.See golang/go#62278 for a detailed discussion.