GO在Visual Studio Code初次运行时提示The “gopls“ command is not available. Run “go get -v golang.org/x/tools/

[部署日记]GO在Visual Studio Code初次运行时提示The “gopls” command is not available. Run “go get -v golang.org/x/tools/gopls” to install.

遇到的问题

在这里插入图片描述

于是无脑Install…

Installing github.com/nsf/gocode FAILED
Installing github.com/uudashr/gopkgs/cmd/gopkgs FAILED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing github.com/acroca/go-symbols FAILED
Installing github.com/rogpeppe/godef FAILED
Installing github.com/sqs/goreturns FAILED
Installing github.com/golang/lint/golint FAILED
Installing github.com/derekparker/delve/cmd/dlv FAILED

在VSC里的terminal运行" go env ",其中显示

set GOPROXY=https://proxy.golang.org,direct

然后在cmd里Ping一下
在这里插入图片描述

所以我们只需要更改cn源就行了…
直接在VSC的terminal输入并回车

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

重启VSC,再点“Install all”
搞定了

猜你喜欢

转载自blog.csdn.net/ABV09876543210/article/details/134811321