The following steps have been tested on Ubuntu. Technically, it shall work similarly in other system (Note: Some systems might require changes in directory path or to use similar command)
Step 1: Removal of existing go package
Remove the golang-go package
sudo apt-get remove golang-go
Remove the golang-go dependencies
sudo apt-get remove --auto-remove golang-go
Uninstall the existing Go package
sudo rm -rvf /usr/local/go
Step 2: Install the new Go version
Download specific binary release for your system
wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz
Note: Replace the go release in bold above to the version for your system. List of version can be found here.
Extract the archive file
sudo tar -xvf go1.14.linux-amd64.tar.gz
Note: Replace the go release in bold above to the downloaded one.
Place the extracted file to desired location on the system
sudo mv go /usr/local
Tips: Above location is recommended on Linux.
Step 3: Setup Go Environment (Linux)
Setup Go environment variable
Open .profile file located at home directory (~/.profile) and add the following lines:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
GOROOT is the location where the Go package is installed on your system.
GOPATH is the work directory of your go project.
Next, reload environment variables for the change to take effect. (Thanks Luis V. for suggestion in the comment)
This can be done by either running the following command in terminal or doing a re-login of current shell.
source ~/.profile
Step 4: Verify Go Version and Environment
Verify the go version
go version
Verify the configured environment variables
go env