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

 本以为VSC在商城装上插件后就能拎包入住,F5的时候我当场好家伙

 于是无脑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
......

 好家伙,我当场terminal运行"go env"其中显示

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

Ping了一下,好家伙

 

搜了下,GO源变量更改语法,在terminal输入

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

然后重启VSC,F5再点“Install all”

好家伙,搞定了

原文地址:https://www.cnblogs.com/cela/p/go_go_1.html