-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: Deduce GOROOT for custom location of prebuilt go #10012
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
Comments
This has been proposed before but rejected. The reason was that a command
should not change behavior based on where it live.
|
Well, I was rather thinking that this thing would be applied only for prebuilts which are easiest to install locally instead of system-wide. I don't know if such use is the most common one, though. So kind of counter-argument for no-behavior-change-on-location-change would be users are changing the behavior for custom installs anyway. The GOROOT deduction would Do The Right Thing for both default installs ( |
One idea is that we change the GOROOT of the installed bin/go by relinking
cmd/go with -ldflags -X runtime.defaultGoroot "the correct goroot".
Relinking cmd/go only requires our 6l, so it should be OK to do during
installation, esp. for windows and Darwin where we can have custom steps
after copying the files.
/cc @adg do you think it's worth doing?
|
Doesn't relinking invalidate checksums of those binary files? So I wouldn't recommend it for official releases. But for roll-your-own go compiler compiled from source, that should be useful. |
You check checksum before installation, and the installer will relink
cmd/go automatically. That won't affect the checksum. In fact, you cannot
check the checksum after installation.
|
The idea is, to verify if something tempered with my binary. e.g. for forensics or security auditing. That's why I only talked about not doing that in releases. |
On Feb 26, 2015 2:40 PM, "Ingo Oeser" notifications@github.com wrote:
I believe the go linker in internal linking mode is fully deterministic now (And normally you do the initial checksum after the installation, so the |
Seems like a lot of trouble to avoid setting an environment variable, and On 27 February 2015 at 07:02, Minux Ma notifications@github.com wrote:
|
Shouldn't prebuilt go's GOROOT be deduced upon go binary's path instead of being hardcoded to /usr/local/go or c:\Go (unless GOROOT env var is specified of course)? Something like following:
The text was updated successfully, but these errors were encountered: