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

How to upgrade golang?

尚
Original
2019-12-04 13:41:46 16583browse

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"

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

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

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/

4. Configure environment variables

Add the path of the go executable file to PATH:

export PATH="/usr/local/go/bin:$PATH"

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 thegolang tutorialcolumn.

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

Statement:
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