zl程序教程

您现在的位置是:首页 >  系统

当前栏目

linux安装go环境并配置国内源

LinuxGo安装配置 环境 国内
2023-09-27 14:29:08 时间

linux安装go环境并配置国内源

第一步、官网下载安装包

https://golang.google.cn/

go1.4.linux-amd64.tar.gz

第二步、解压缩

tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz

/usr/local指目录,可自行修改

第三步、添加环境变量

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

第四步、配置国内源

Linux版本

  echo "export GO111MODULE=on" >> ~/.profile
  echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
  source ~/.profile

附:

Windows 版本

 SETX GO111MODULE on    
 go env -w GOPROXY=https://goproxy.cn,direct
 SETX GOPROXY https://goproxy.cn,direct