Linux下GO 1.16.X安装配置(图文详细)
一、资源准备
- 资源下载地址: https://golang.google.cn/dl/

二、GOROOT配置
cd /opt/soft
tar -zxvf go1.16.4.linux-amd64.tar.gz -C /opt/module/
cd /opt/module/ && mv go go1.16.4 && ll

vim /etc/profile
export GOROOT=/opt/module/go1.16.4
export PATH=$PATH:$GOROOT/bin
source /etc/profile

#测试命令
go version

三、GOPATH配置
#创建存储目录
mkdir -p /opt/GP/bin /opt/GP/pkg /opt/GP/src && cd /opt/GP && ll

vim /etc/profile
export GOPATH=/opt/GP
export PATH=$PATH:$GOPATH/bin
source /etc/profile

echo $GOPATH

三、环境配置
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=off
go env -w GOSUMDB="sum.golang.google.cn"
go env
