Create "go path" directory (will store downloads and the source code that you yourself write)
mkdir ~/go
add following to your .bashrc or somewhere
if [ -d $HOME/go ]; then
export GOPATH=${HOME}/go
export PATH=${PATH}:${GOPATH}/bin
fi
Begin by installing ubuntu version of golang
sudo apt install golang
Then donwload, compile and install "godeb". Godeb transforms upstream tarballs for the Go language in deb packages and installs them.
go get gopkg.in/niemeyer/godeb.v1/cmd/godeb
To use godeb run
godeb list # list all available versions
godeb install # build latest
godeb install 1.8.3 # build specific version
Run following to build latest golang compiler. This will take a while...
godeb install
After build finishes the package that godeb built will be in current dir
ls go_*.deb
Uninstall the ubuntu version of golang before installing the new version (they would conflict)
sudo apt remove golang
sudo apt auto-remove
Then install
sudo dpkg -i go_*.deb