go下载依赖提示连接失败

1、现象

Go下载模块提示连接失败

dial tcp 142.251.42.241:443: connectex: A connection attempt failed because the connected party did not properly respond after a period
of time, or established connection failed because connected host has failed to respond.

 2、解决办法

①查看go env中的GOSUMDB变量

go env

 ②关闭GOSUMDB

go env -w GOSUMDB=off

 ③设置代理为https://goproxy.cn,direct

go env -w GOPROXY=https://goproxy.cn,direct

 

 ④再次下载

 参考连接: https://blog.csdn.net/qq_37767455/article/details/121188740

posted @ 2021-12-20 22:02  南风丶轻语  阅读(3675)  评论(0编辑  收藏  举报