在开始使用golang的时候,经常会遇到各种问题,总结在此
1.
golang 在 github 上建立了一个镜像库,下载github上的镜像库放入GOPATH下即可
mkdir -p $GOPATH/src/golang.org/x cd $GOPATH/src/golang.org/x git clone https://github.com/golang/sync.git git clone https://github.com/golang/crypto.git git clone https://github.com/golang/sys.git
2.
go包管理代理网址无法访问:proxy.golang.org
解决:
go env -w GOPROXY=https://goproxy.cn
3.
verifying module: invalid GOSUMDB: malformed verifier id
解决:
关闭包验证
go env -w GOSUMDB=off
4. 设置go env -w GOPROXY=***warning: go env -w GOPROXY=... does not override conflicting OS environment variable
解决方案:
unset GOPROXY
再重新设置即可