gonative icon indicating copy to clipboard operation
gonative copied to clipboard

Easier Bootstrap for Go 1.5+

Open inconshreveable opened this issue 9 years ago • 4 comments
trafficstars

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 avatar Dec 02 '15 19:12 inconshreveable

@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...

tchap avatar Dec 03 '15 09:12 tchap

Woah, definitely didn't realize it did that. Looks like we'll need to be a bit more sophisticated. Thanks for pointing that out!

inconshreveable avatar Dec 03 '15 09:12 inconshreveable

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:

  1. In case GOROOT_BOOTSTRAP is set, we are done.
  2. Otherwise check $HOME/go1.4.
  3. Otherwise check whether there is any Go >= 1.4 installed, e.g. by using go version and which go and/or just checking the default location at /usr/local/go.
  4. Otherwise download any Go >= 1.4 and use that.

tchap avatar Dec 07 '15 10:12 tchap

Yep, I think that's an all around good solution! I'll take a crack at this when I have some time.

inconshreveable avatar Dec 08 '15 21:12 inconshreveable