First we need to get the latest release link for our linux (1.16.2 at the time of writing).

You can find the different addresses here

Installation⌗

# First we download the appropriate archive
$ curl https://dl.google.com/go/go1.16.2.linux-amd64.tar.gz https://dl.google.com/go/go1.16.2.linux-amd64.tar.gz -o golang.tar.gz
# Second, it is recommended to compare the shasum of the file you downloaded against the one present on the go website
$ shasum golang.tar.gz
# Third, we extract the archive
$ tar -xvf golang.tar.gz
# Fourth, we change the permission to root:root on the extracted folder
$ sudo chown -R root:root ./go
# Then we move the installation to /usr/local
$ sudo mv go /usr/local

Setting up the path⌗

Next, we have to setup the path, this is to do on your .profile or .zshrc,… file

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Don’t forget to relaunch your terminal

Testing⌗

$ go version

should give you an output stating the go version