gonative
gonative copied to clipboard
Easier Bootstrap for Go 1.5+
Building Go 1.5+ from source requires that an existing 1.4 Go toolchain be on your machine and specified via the GOROOT_BOOTSTRAP environment variable. gonative will fail if that's not supplied right now if you're building Go1.5+. Instead, if the env var is unspecified, gonative should download a Go 1.4 installation native to your platform and use that for the bootstrap process.
@inconshreveable From what I understand after reading https://golang.org/doc/install/source, the variable has a default value, which is $HOME/go1.4. So making sure the variable is set is perhaps not 100% correct. But you can always say in the docs that you require it to be set...
Woah, definitely didn't realize it did that. Looks like we'll need to be a bit more sophisticated. Thanks for pointing that out!
IMO it is enough to have Go >= 1.4. This is the error message from make.bash:
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
So in case any such Go installation is present, we can use it, unless GOROOT_BOOTSTRAP is set. So it could be something like:
- In case
GOROOT_BOOTSTRAPis set, we are done. - Otherwise check
$HOME/go1.4. - Otherwise check whether there is any Go
>= 1.4installed, e.g. by usinggo versionandwhich goand/or just checking the default location at/usr/local/go. - Otherwise download any Go
>= 1.4and use that.
Yep, I think that's an all around good solution! I'll take a crack at this when I have some time.