Goproxy官网地址:https://goproxy.cn/
go env
具体信息如下:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sundgping/Library/Caches/go-build"
GOENV="/Users/sundgping/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/sundgping/go"
GOPRIVATE=""
GOPROXY=""
GOROOT="/usr/local/Cellar/go@1.14/1.14.12/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go@1.14/1.14.12/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/sundgping/go/src/github.com/chaosblade-io/chaosblade/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/q7/zy3gg6ys6tnc72l7x9njwr0c0000gn/T/go-build603115339=/tmp/go-build -gno-record-gcc-switches -fno-common"
(1)Go.1.13及以上使用
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct
(2)macOS 或 Linux
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn
或者
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
go env
命令查看配置信息GO111MODULE 和 GOPROXY 的值变成我们设置的值,即为配置Goproxy成功