Home > Backend Development > Golang > How to upgrade golang?

How to upgrade golang?

Release: 2019-12-04 13:41:46
Original
16727 people have browsed it

How to upgrade golang?

Upgrade Golang

Main steps:

1. Uninstall the old version

2. Download the new version

3. Install the new version

4. Configure environment variables

Detailed steps:

1. Uninstall the old version

First, execute go env, list Out the environment information about go, check the value of GOROOT, which generally represents the installation path of go;
For example:

GOROOT="/usr/local/go"
Copy after login

After that,

if it was installed through yum or apt-get before Go, then execute the relevant code to uninstall it:

yum remove go
apt-get remove go
Copy after login

If it is installed directly manually (that is, installed by copying to a certain directory), you can directly delete the go folder according to the path provided by GOROOT :

rm -r /usr/local/go
Copy after login

2. Download the new version

Go to the official website to download the latest version, such as go1.11.linux-amd64.tar.gz

3. Install the new version

Unzip: tar zxvf go1.11.linux-amd64.tar.gz

After getting the go folder, move or copy it to the go installation path you just obtained:

mv ./go /usr/local/
Copy after login

4. Configure environment variables

Add the path of the go executable file to PATH:

export PATH="/usr/local/go/bin:$PATH"
Copy after login

If the path of the previous version is the same, there is no need to add it repeatedly.

For more golang knowledge, please pay attention to the golang tutorial column.

The above is the detailed content of How to upgrade golang?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template