1 前言
在进行Go开发的时候,设置Go的环境变量信息是必须的。下面介绍windows和Linux,以及Go自身提供的命令进行设置的形式
2 设置
2.1 Linux的设置
In Linux or macOS, you can execute the below commands.(在Linux或者macOS,你可以执行下面的命令)
# Enable the go modules feature
export GO111MODULE=on
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io
2.2 Windows设置
In Windows, you can execute the below commands.(在Windlows中,你可以执行下面的命令)
# Enable the go modules feature
$env:GO111MODULE="on"
# Set the GOPROXY environment variable
$env:GOPROXY="https://goproxy.io"
Go version >= 1.13 当你的GO的版本大于1.13的时候
当你安装的GO的语言版本大于1.13的时候,那么就不用这么麻烦了,直接使用go env -w命令就行了
go env -w GOPROXY=https://goproxy.io,direct
# Set environment variable allow bypassing the proxy for selected modules
go env -w GOPRIVATE=*.corp.example.com
go env -w GO111MODULE=on
3 国内代理
4 参考
来源:https://www.cnblogs.com/fanbi/p/13649929.html |