Building Go from source

If you don’t already have some version of Go installed it’s best to grab a bootstrap tarball built by 9legacy folks:

cd /tmp
hget | bunzip2 -c | tar x

Next, grab the source for the version of Go you want to build:

hget | gunzip -c | tar x

With the bootstrap and source ready to build we’ll need to create a GOROOT. The usual location, and the one we’ll use here, is /sys/lib/go/$arch-$version. Create the directory and bind the downloaded Go source directory over it, then change into the src/ directory under the real GOROOT so that the correct path is picked up during the build:

mkdir -p /sys/lib/go/amd64-1.15.2
bind -c go /sys/lib/go/amd64-1.15.2
cd /sys/lib/go/amd64-1.15.2/src

Finally, we can start the build, making sure to set the GOROOT_BOOTSTRAP environment variable to the path where the bootstrap package is extracted:


This will build the binaries under $GOROOT/bin. You can install these with:

cp $GOROOT/bin/* /$objtype/bin

or bind them to /bin in your profile:

bind $GOROOT/bin /bin