go安装gin框架失败错误解决:sum.golang.org被墙

go版本:

go version go1.13.6 windows/amd64

在使用下面命令准备安装gin试用一下时,发现,是不是卡主,然后直接报错:

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


go: finding github.com/gin-gonic/gin v1.5.0
go: downloading github.com/gin-gonic/gin v1.5.0
verifying github.com/gin-gonic/[email protected]: github.com/gin-gonic/[email protected]: Get https://sum.golang.org/lookup/github.com/gin-gonic/[email protected]: dial tcp 172.217.160.81:443: connectex: A connection attempt failed because the connected party did not properly respond a
fter a period of time, or established connection failed because connected host has failed to respond.

一开始非常的奇怪,单独拿地址也可以正常访问啊,因为本人就没关过,关闭了VPN后发现地址竟然被墙了,坑爹,这为啥啊!

然后查了问题是自go1.13版本后设置了默认的GOSUMDB=sum.golang.org,但地址是被墙了的,需要命令关闭:

go env -w GOSUMDB=off

 重新运行安装命令,直接通过。

你可能感兴趣的:(go)