Upgrade your Golang version - The easy way
How to upgrade your Golang version without removing the old one
The first step, you must be sure that the Golang bin folder (which is the folder used to store your downloaded go third party packages) is in your PATH environment variable, if not you can simply add the following line to your .profile file or .bashrc file in the home folder.
export PATH=$PATH:<your GOPATH>/bin
if you don't know your GOPATH, you can find it by running
go env | grep GOPATH
Download the version installer using the go cli
go get golang.org/dl/go1.17rc2 ## or the version you want
Download the new version
go1.17rc2 download
Then you can access the new version executable using the go1.17rc2 command.
or if you want to access it using the go command and remove the old go version you can run the following command
sudo rm -rvf /usr/local/go/bin/go && sudo mv <your GOPATH>/bin/go1.17rc2 /usr/local/go/bin/go