Go语言安装配置
下载地址
安装配置
vim /etc/profile
# 在最后加入
export GOROOT=/usr/local/go
export GOPATH=/root/go
export PATH=${PATH}:${GOROOT}/bin
配置go代理和gomod模式
推荐两个go国内代理网站:
https://goproxy.cn/
https://goproxy.io/zh/
# 配置gomod 和 goproxy
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
# 环境变量方式
echo "export GO111MODULE=on" >> /etc/profile
echo "export GOPROXY=https://goproxy.cn" >> /etc/profile
source /etc/profile