1、配置环境变量:

gedit ~/.bashrc

在末尾加上如下:

export LD_LIBRARY_PATH=/usr/local/lib
export GOPATH=$HOME/goproject
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:$PATH:$GOROOT/bin
export GOROOT=/usr/local/bin/go

2、通过go语言中文网下载linux压缩包

https://studygolang.com/dl

3、将压缩包解压后,将go文件夹整个移动到/usr/local/bin/下代替原来的go语言文件夹。

sudo mv /解压地址/go  /usr/local/bin

4、更新一下

source ~/.bashrc
go version