Skip to content

cmd/go: use os.Executable and drop GOROOT instructions #19232

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

Closed
crawshaw opened this issue Feb 22, 2017 · 1 comment
Closed

cmd/go: use os.Executable and drop GOROOT instructions #19232

crawshaw opened this issue Feb 22, 2017 · 1 comment
Milestone

Comments

@crawshaw
Copy link
Member

A common refrain on the Go mailing list is "don't use GOROOT". It is good advice, GOROOT leads to confusion.

However, right on the Go download page, https://golang.org/doc/install, users are instructed to set a GOROOT: "In this case you must set the GOROOT environment variable to point to the directory in which it was installed."

I sometimes give users alternate instructions about how to use a copy of the binary toolchain they just downloaded as GOROOT_BOOTSTRAP to rebuild the toolchain in its new location, so that setting GOROOT is not necessary. But this is several extra steps of work that are mysterious to a new Go user.

As an alternative, Go 1.8 introduced os.Executable. The cmd/go binary could use this to find its own GOROOT, and do the right thing by default if the distribution is installed to an unusual location.

WDYT? @rsc @ianlancetaylor

@crawshaw crawshaw added this to the Go1.9 milestone Feb 22, 2017
@crawshaw
Copy link
Member Author

Ah, my first github issue search was bad. This is a duplicate of #18678.

@golang golang locked and limited conversation to collaborators Feb 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants