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 | golang: |
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 | cd ~ |
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 | sudo mv ./go /usr/local |
Clean up and create your workspace:
1 | cd ~ |
All done! Check your installation:
1 | go version |