解决:使用VS开发Go时,Go扩展安装失败

解决:使用VS开发Go时,Go扩展安装失败,第1张

报错信息
Installing github.com/nsf/gocode FAILED
Installing github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing github.com/acroca/go-symbols FAILED
Installing golang.org/x/tools/cmd/guru FAILED
Installing golang.org/x/tools/cmd/gorename FAILED
Installing github.com/fatih/gomodifytags FAILED
...
解决过程

官方Go模块代理说明链接点此处跳转Github

其中在Windows下
打开cmd,依次输入下面语句:

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

在macOS或Linux下
打开终端,依次输入下面语句:

export GO111MODULE=on
export GOPROXY=https://goproxy.cn

echo "export GO111MODULE=on" >> ~/.profile
echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
source ~/.profile
回到VS code,成功安装所有扩展
Tools environment: GOPATH=C:\Users\mac\go
Installing 10 tools at C:\Users\mac\go\bin in module mode.
  gopkgs
  go-outline
  gotests
  gomodifytags
  impl
  goplay
  dlv
  dlv-dap
  staticcheck
  gopls

Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs (C:\Users\mac\go\bin\gopkgs.exe) SUCCEEDED
Installing github.com/ramya-rao-a/go-outline (C:\Users\mac\go\bin\go-outline.exe) SUCCEEDED
Installing github.com/cweill/gotests/gotests (C:\Users\mac\go\bin\gotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags (C:\Users\mac\go\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl (C:\Users\mac\go\bin\impl.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay (C:\Users\mac\go\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv (C:\Users\mac\go\bin\dlv.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@master (C:\Users\mac\go\bin\dlv-dap.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck (C:\Users\mac\go\bin\staticcheck.exe) SUCCEEDED
Installing golang.org/x/tools/gopls (C:\Users\mac\go\bin\gopls.exe) SUCCEEDED

All tools successfully installed. You are ready to Go :).

欢迎一键三连~~ 😉

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/994825.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存