Legacy post. This article was written between 2016 and 2018. Software versions, commands and services mentioned here may be outdated. Check the official documentation before running anything.
Download ARM Version
wget https://storage.googleapis.com/golang/go1.9.1.linux-armv6l.tar.gz
Extract
sudo tar -C /usr/local -xzf go1.9.1.linux-armv6l.tar.gz
Create GOPATH directory
mkdir -p /home/pi/workspace/go
Export Env Variables
Edit your bashrc:
vim ~/.bashrc
Add the following variables:
export GOPATH=/home/pi/workspace/go
export GOROOT=/usr/local/go
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
Reload bash
. ~/.bashrc
Test
go version
Output:
go version go1.9.1 linux/arm
Clean up
rm go1.9.1.linux-armv6l.tar.gz