天天看点

The “gopls“ command is not available. Use “go get -v golang.org/x/tools/cmd/gopls“ to install.解决

在网上找到一个更好的方法,直接设置代理,然后重启vscode按照提示安装

$ go env -w GO111MODULE=on

$ go env -w GOPROXY=https://goproxy.io,direct

注意:GO111MODULE这个选项有其他含义,可在安装完成之后调回off或auto

以下是原回答

在VSCode中安装GO扩展的时候,总会有各种安装失败的问题。如果翻墙和网络什么的都没问题,也试过其他网友的方法,还是不行的话,试试下面的。

当点击右下角弹出的提示框的安装的时候

The “gopls“ command is not available. Use “go get -v golang.org/x/tools/cmd/gopls“ to install.解决

就像这样,实际上要关注的是红框内是否是你设置的GOPATH。

如果不是的话,打开setting.json文件

The “gopls“ command is not available. Use “go get -v golang.org/x/tools/cmd/gopls“ to install.解决

添加

"go.gopath": "/home/cwm/go"

这段代码,当然,其中的真实路径改成你自己的!

然后再重新安装就行了。

上一篇: msgfmt not found

继续阅读