在使用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/x
在github/golang
下有鏡像文件,故手動在$GOPATH/src
目錄創建golang.org/x
子目錄,並進入目錄中,clone
github/golang下的倉庫。
git clone https://github.com/golang/gopls