If you are upgrading from an older version of Go you must first remove the existing version. Following is curated options to update Go to latest version. You can refer to Go official download page to get the latest version.
Linux
System: Debian/Ubuntu/Fedora. Might work for others as well.
1. Uninstall the existing 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
Another way to uninstall Go:
apt-get purge golang-gorm -rvf /usr/local/go/Remove any mention of go in e.g. your ~/.bashrc and then do command
One liner installer:
curl --silent https://storage.googleapis.com/golang/go1.12.9.darwin-amd64.tar.gz | sudo tar -vxz --strip-components 1 -C /usr/local/go
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/nikhita/Downloads/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"
Windows
MSI installer
Open the MSI file and follow the prompts to install the Go tools. By default, the installer puts the Go distribution in c:\Go
.
The installer should put the c:\Go\bin
directory in your PATH
environment variable. You may need to restart any open command prompts for the change to take effect.
Setting environment variables under Windows
Under Windows, you may set environment variables through the “Environment Variables” button on the “Advanced” tab of the “System” control panel. Some versions of Windows provide this control panel through the “Advanced System Settings” option inside the “System” control panel.
Originally posted 2019-08-16 23:11:58.
Trending:
- Golang update Windows