-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Go: Better determine Go versions in Go 1.21+ #14194
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test failures are expected until the internal PR is merged, I think. |
smowton
reviewed
Sep 13, 2023
mbg
force-pushed
the
mbg/go/1.21-toolchain-handling
branch
from
September 13, 2023 12:24
a308622
to
406e2b8
Compare
smowton
previously approved these changes
Sep 13, 2023
mbg
force-pushed
the
mbg/go/1.21-toolchain-handling
branch
from
September 15, 2023 16:26
406e2b8
to
0dad95b
Compare
mbg
force-pushed
the
mbg/go/1.21-toolchain-handling
branch
from
September 20, 2023 10:18
0dad95b
to
f5c97a2
Compare
owen-mc
reviewed
Sep 20, 2023
owen-mc
requested changes
Sep 20, 2023
owen-mc
previously approved these changes
Sep 20, 2023
mbg
force-pushed
the
mbg/go/1.21-toolchain-handling
branch
from
September 22, 2023 13:54
afae037
to
67a2bfd
Compare
owen-mc
previously approved these changes
Sep 26, 2023
Refactors `tryReadGoDirective` to return this instead of a pair. This will make it easier to return multiple versions.
- Use a version that is accepted by Go tooling - Run is no longer successful with Go 1.21
We allow them, but don't do anything with them yet.
mbg
force-pushed
the
mbg/go/1.21-toolchain-handling
branch
from
October 6, 2023 10:45
67a2bfd
to
4feb56b
Compare
Closing this PR since most of the changes have made their way into the autobuilder elsewhere since. I opened #16375 for the more tolerant version regex. Better handling of toolchain versions is still required. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
In Go 1.21 and above,
go
commands will try to download the version of Go that is specified in thego.mod
file. This means that running e.g.go version
in a folder with ago.mod
file won't actually return the version of the Go tools installed on the system, but will instead cause them to try and download the version specified ingo.mod
and then invoke the downloaded toolchain'sversion
command.We now work around this by invoking
go version
outside of the working directory in a location where we assume nowithgo.mod
file is present, as this will cause thego
tool to print its own version.GOTOOLCHAIN=local
(thanks @smowton!)We further lay some groundwork for understanding the new Go version format and
toolchain
directives.The
newer-go-version-needed
test / diagnostic essentially no longer applies to Go 1.21 and above. We do not currently have the test infrastructure to test with multiple system versions of Go in place, so I have removed the expected diagnostic output.