SBaronda.com a little place I like to call home.


Bootstrapping Go on Debian

Aug. 27, 2016

9/7/2016 - Updated document to describe updating versions.

Go 1.7 came out about 1 week ago. I've always built my Go via source and here is the process that I use on a fresh system:

First my OS:

cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Now to building:

cd $HOME
wget https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz
mkdir go1.4
tar xvzf go1.4.3.linux-amd64.tar.gz -C go1.4 --strip-components=1
rm go1.4.3.linux-amd64.tar.gz
git clone https://github.com/golang/go.git
cd repos/go
git checkout go1.7
cd src
GOROOT_BOOTSTRAP=$HOME/go1.4/ ./all.bash
ln -s $HOME/repos/go/bin/go $HOME/bin/go
go version
=> go version go1.7 linux/amd64

After you've have a go version locally you don't need to keep the go 1.4 version around.

rm -rf $HOME/go1.4

To update it's as simple as fetching new code and building:

cd $HOME/repos/go
git fetch
git checkout go1.7.1
cd src
./all.bash
ln -fs $HOME/repos/go/bin/go $HOME/bin/go
go version
=> go version go1.7.1 linux/amd64


comments powered by Disqus