添加环境变量:

GO111MODULE=on
GOPROXY=Goproxy.cn

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


goland需要设置下GOROOT和GO MODULE https://goproxy.cn,direct 不然没有gin框架的代码提示,注意这里多了 “,direct”

go mod init xxx_ooo 随便创建个mod名称

ok了就下载gin :

go get -u github.com/gin-gonic/gin

如果出现

fatal: unable to access 'https://github.com/gin-gonic/gin/': 
Failed to connect to xx.xx.xx.xx port 1080 after 2039 ms: 
Connection refused

建议取消代理或者添加代理(视情况而定)

git config --global http.proxy  查询代理

git config --global --unset http.proxy  取消代理

git config --global http.proxy http://127.0.0.1:8080

git config --global https.proxy http://127.0.0.1:8080