/dev/urandom

/dev/urandom

Pseudorandom thoughts generator.

I'm Niccolò Maggioni.
Student, geek and developer.

Go on C.H.I.P.

As per the latest 4.4 build of NTC’s C.H.I.P. OS, based on Debian Jessie, if you issue a plain apt-get install golang a rather old version of the language will be pulled, v1.3.3 at the moment of writing.

The Jessie-backports repo is already enabled by default, but its priority correctly stops you from pulling packages from it automatically - even if it contains the newer version that you need.

apt-cache policy golang produces:

1
2
3
4
5
6
7
8
9
10
11
golang:
Installed: (none)
Candidate: 1.3.3-1
Version table:
2:1.6.1+1~bpo8+1 0
100 http://http.debian.net/debian/ jessie-backports/main armhf Packages
100 /var/lib/dpkg/status
2:1.5.1-4~bpo8+1 0
100 http://http.debian.net/debian/ jessie-backports/main armhf Packages
2:1.3.3-1 0
500 http://ftp.us.debian.org/debian/ jessie/main armhf Packages

Latest version from jessie-backports

Since I couldn’t get APT to recognise the weird 1.6.1+1~bpo8+1 version string, I used a little trick to force it to pull the latest version globally available:

1
sudo apt-get install golang=\*

APT will probably complain about other missing packages - especially if you had previously installed an older version of the golang package and its dependencies - the following extras should stop its complaints:

1
sudo apt-get install golang=\* golang-doc=\* golang-go=\* golang-src=\*

Run go env to check that your GOROOT is something along the lines of GOROOT="/usr/lib/go-1.6".

Latest version from stretch (testing)

Enable the testing repos to obtain the latest Go version (v1.7 at the moment of writing).

Working with partially enabled unstable repos on the C.H.I.P. is a damn pain. Screw that and barbarically download the official builds from the releases page. See below.

Latest version from the official releases

Download and extract the latest binaries (v1.7.4 at the moment of writing) for the ARM architecture:

1
2
3
4
cd ~
mkdir go_release && cd $_
wget https://storage.googleapis.com/golang/go1.7.4.linux-armv6l.tar.gz
tar -xzf go*.tar.gz

Remove any installed version of the golang package and its dependencies:

1
sudo apt-get autoremove golang golang-go

And proceed with installing the new version:

1
2
sudo mv ./go /usr/local
eval $(echo -e '\nexport PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile)

Clean up and create your workspace:

1
2
3
4
5
cd ~
rm -r go_release
mkdir go
eval $(echo -e '\nexport GOPATH=$HOME/go' | tee -a ~/.bashrc)
sudo apt-get install git

All done! Check your installation:

1
2
go version
go env

Found this article useful? Crypto makes for an excellent tip!

1LZto1zhrzHgFssZRbgG4WB9oW1RfbSc7F
0x3587C66f56C6C696A031b50451Ae68fE34993405
GBA3DXBLWF4WN32XANZWU65WIYJJIV7FKXO4VDYLMEQ7HTPZJMVV4733

Share this