运行go mod tidy,报错:
go: golang.org/x/sys@v0.0.0-20180905080454-ebe1bf3edb33: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: c
onnectex: 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.)
go: error loading module requirements
原因是某些依赖在国内被墙了,这边可以设置一下proxy,就可以解决:
进入Goland的设置界面,File/Settings/Go/Go Module(vgo),设置一下Proxy为:https://goproxy.io。

本文介绍了在使用Go语言开发过程中遇到的gomodtidy错误,特别是关于golang.org/x/sys依赖的问题。文中提供了通过设置代理来解决国内网络环境下依赖下载失败的方法。

1695

被折叠的 条评论
为什么被折叠?



