Go语言安装配置

下载地址

Go语言官方网站
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
posted @ 2021-05-02 15:45  风之老凌  阅读(56)  评论(0)    收藏  举报