Skip to content

Instantly share code, notes, and snippets.

@Kirbo
Last active March 12, 2020 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kirbo/e9f14ca4c63782b00bdbc0abe0821885 to your computer and use it in GitHub Desktop.
Save Kirbo/e9f14ca4c63782b00bdbc0abe0821885 to your computer and use it in GitHub Desktop.

If already installed old golang:

sudo apt remove golang*
sudo apt-get autoremove
sudo rm -rf /usr/local/go
source ~/.bashrc

Install latest Golang:

url=$(curl https://golang.org/dl/ | grep armv6l | sort --version-sort | tail -1 | grep -o -E "https://dl.google.com/go/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-armv6l.tar.gz")
archive_name=$(echo ${url} | cut -d '/' -f5)
wget ${url}
sudo tar -C /usr/local -xvf ${archive_name}
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
rm ${archive_name}
source ~/.bashrc

Test:

go version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment