go:远程包安装问题

在使用go get安装gopls时发现连接超时,错误如下:

命令

go get golang.org/x/tools/gopls

输出

package golang.org/x/sync/errgroup: unrecognized import path "golang.org/x/sync/errgroup" (https fetch: Get https://golang.org/x/sync/errgroup?go-get=1: dial tcp 216.239.37.1: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.)

解决方案

由于golang.org/xgithub/golang下有镜像文件,故手动在$GOPATH/src目录创建golang.org/x子目录,并进入目录中,clonegithub/golang下的仓库。

git clone https://github.com/golang/gopls

转载于:https://www.cnblogs.com/luoheng23/p/11172194.html

你可能感兴趣的:(go:远程包安装问题)