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: Deal with incorrect toolchain versions #15979
base: main
Are you sure you want to change the base?
Conversation
6a14e3f
to
c74d634
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to test an actual download, consider setting GOPATH to an empty directory so it certainly won't find an existing toolchain downloaded by a prior integration test or similar.
| workingDir, | ||
| ) | ||
|
|
||
| // Run the command. If something goes wrong, report it to the log and signal failure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider marking this as "installed" regardless to avoid repeatedly attempting to install the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this. It seems like a rare scenario where we would repeatedly attempt to install the same version and that fails for whatever reason.
If I had implemented this set specifically for the new check, then okay, but since the implementation is more general, it might lead to weird results down the line if we want to utilise the set of installed versions for something else and find that in some cases those aren't actually installed.
|
@smowton We already set a custom |
|
seems to work locally for me ( |
Starting in Go 1.21, Go uses a new version format for toolchains which uses the
1.N.Psyntax. This is a problem for our users when theirgo.modfiles only contain agodirective that uses the old version format, e.g.go 1.22.1.22is a valid language version, but not a valid toolchain version. If there is no additionaltoolchaindirective in thego.modfile, thengouses the language version as the toolchain version. In the example,1.22is not a valid toolchain version and certaingocommands, particularly those which try to acquire the toolchain corresponding to that version, fail with an unhelpful error.In this PR, we make two changes to the Go autobuilder:
go.modfiles where the language version is1.21or greater, doesn't use the new toolchain version syntax, and there is no explicittoolchaindirective. We emit a warning-level diagnostic in this case.go versionwithGOTOOLCHAIN=go1.N.P(i.e. the correct representation of the toolchain version) to getgoto install that version and avoid subsequent errors despite the incorrect version format. As an optimisation for repos with a lot ofgo.modfiles, we now keep track of toolchain versions that we know are installed and only do this if we don't yet know that the corresponding version is installed.