Skip to content

Instantly share code, notes, and snippets.

@mkuchak
Forked from nikhita/update-golang.md
Last active January 7, 2023 16:55
Show Gist options
  • Save mkuchak/89d69c3b612973d95f2580a0825c9038 to your computer and use it in GitHub Desktop.
Save mkuchak/89d69c3b612973d95f2580a0825c9038 to your computer and use it in GitHub Desktop.
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

$ sudo rm -rf /usr/local/go

OR

$ whereis go
$ sudo apt remove go-golang -y

2. Install the new version

Go to the downloads page and download the binary release suitable for your system.

3. Extract the archive file

To extract the archive file:

$ sudo tar -C /usr/local -xzf /home/mkuchak/go1.8.1.linux-amd64.tar.gz

4. Make sure that your PATH contains /usr/local/go/bin

$ echo $PATH | grep "/usr/local/go/bin"

Add on ~/.bashrc and ~/.zshrc or ~/.profile:

export PATH="$PATH:/usr/local/go/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment