Goland 使用 go modules的TIPS

运行go mod tidy,报错:

go: golang.org/x/[email protected]: 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。

Goland 使用 go modules的TIPS_第1张图片

你可能感兴趣的:(Goland 使用 go modules的TIPS)