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

[gomod] Fix toolchain selection (legacy 1.20 vs 1.21.0+) #787

Open
eskultety opened this issue Jan 17, 2025 · 0 comments
Open

[gomod] Fix toolchain selection (legacy 1.20 vs 1.21.0+) #787

eskultety opened this issue Jan 17, 2025 · 0 comments
Labels
bug Something isn't working gomod Pull requests/issues related to the gomod handling module

Comments

@eskultety
Copy link
Member

When Go 1.21 was released it changed the game significantly because it started enforcing the 'go X.Y.Z' line in one's go.mod file as the minimum required version to process/build a project. That lead to some undesirable side effects of newer Go toolchains dirtying users source repositories that still used old Go releases with upgrade-related cruft. The bandaid we applied at the time was to start supporting 2 Go toolchain streams - one for legacy projects and one for 1.21+ based projects. We build it around the 'GOTOOLCHAIN=auto' variable which let us to download any user desired toolchain on demand during prefetch automatically. Therefore, with the 1.21+ toolchains we are always fixed a 0th release of a particular language release, e.g. 1.21.0. The problem however is that the code is somewhat buggy.
It is time for us to get rid of the legacy toolchain (EOL in upstream) and only process input repositories with a single one. Addressing this should include:

  1. querying all installed go binaries on the system (system PATH, our locations, user HOME path)
  2. query the toolchains early in the prefetch process (i.e. before _fetch_gomod)
  3. pick the best toolchain for the job based on the go.mod contents and on results from step 2.
  4. Log the actual toolchain version that is to be used AND log both toolchain versions if we don't have the desired one and go will need to download it automatically for us
  5. Let dependabot automatically update the micro release of the pre-installed toolchain in our image (i.e. decrease our dependence on GOTOOLCHAIN=auto)
  6. Drop the legacy 1.20 toolchain support and its install from our container image
@eskultety eskultety added the gomod Pull requests/issues related to the gomod handling module label Jan 17, 2025
@eskultety eskultety added this to the Improving the Go backend milestone Jan 17, 2025
@eskultety eskultety added the bug Something isn't working label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gomod Pull requests/issues related to the gomod handling module
Projects
None yet
Development

No branches or pull requests

1 participant