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

Ubuntu images incorrectly set GOROOT #2655

Closed
3 of 7 tasks
FiloSottile opened this issue Feb 8, 2021 · 4 comments
Closed
3 of 7 tasks

Ubuntu images incorrectly set GOROOT #2655

FiloSottile opened this issue Feb 8, 2021 · 4 comments

Comments

@FiloSottile
Copy link

Description

The Ubuntu images should not be setting the GOROOT environment variable.

The GOROOT environment variable is mostly deprecated, and no setup requires it. The go tool knows to look next to the binary path as well as at the path at which it was built (or at the build-time GOROOT_FINAL value), so it can find its GOROOT automatically.

The problem with hardcoding a GOROOT is that if any other go tool is in use (for example, because one compiled Go tip), the environment variable will override its autodetected GOROOT. The result is that the GOROOT and the go binary will mismatch, leading to obscure errors.

Related: #2452

Area for Triage:
Go

Question, Bug, or Feature?:
Bug

Virtual environments affected

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11.0
  • Windows Server 2016 R2
  • Windows Server 2019

Image version
20210131.1

@dibir-magomedsaygitov dibir-magomedsaygitov added OS: Ubuntu Area: Go investigate Collect additional information, like space on disk, other tool incompatibilities etc. and removed needs triage labels Feb 9, 2021
@dsame dsame self-assigned this Feb 9, 2021
@maxim-lobanov
Copy link
Contributor

Just a note: GOROOT variable is set up on images for a long time (~2-3 years). #2452 just adds it to the documentation.
If we would like to get rid of this variable - we should do proper communication around it to make sure that we won't break any use-cases. Also it makes sense to do these changes consistency across all images.

@FiloSottile , do you aware about any use-cases that could be broken by removing this variable?

@FiloSottile
Copy link
Author

The only breakage I can imagine is from scripts that use $GOROOT directly for some reason, instead of $(go env GOROOT). These scripts would only work in the GitHub Actions environment, since most systems don't have $GOROOT defined.

@dsame
Copy link
Contributor

dsame commented Mar 1, 2021

The changes are moved to vm rollout and will be available soon

@miketimofeev
Copy link
Contributor

The changes were deployed everywhere.
@FiloSottile thanks for bringing this up!

@miketimofeev miketimofeev removed the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants