dongtieshang5429
2018-04-24 03:09
浏览 205
已采纳

无法在Visual Studio Code中安装Go扩展程序

When I try to install the Go Extension in my Visual Studio Code, and I got these error messages as below. Am I missing something here?

 gocode
  gopkgs
  go-outline
  go-symbols
  guru
  gorename
  godef
  goreturns
  golint
  dlv

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 golang.org/x/tools/cmd/guru FAILED
Installing golang.org/x/tools/cmd/gorename 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

10 tools failed to install.

gocode:
Error: Command failed: /usr/local/go/bin/go get -u -v github.com/nsf/gocode
package github.com/nsf/gocode: cannot download, /home/bitnumbers/go is a GOROOT, not a GOPATH. For more details see: 'go help gopath'
package github.com/nsf/gocode: cannot download, /home/bitnumbers/go is a GOROOT, not a GOPATH. For more details see: 'go help gopath'

Please advice.

图片转代码服务由CSDN问答提供 功能建议

当我尝试在Visual Studio Code中安装Go Extension时,出现以下错误消息。\ nAm我在这里遗漏了什么吗?

  gocode 
 gopkgs 
大纲
符号
大师
姓氏
 godef 
 goreturns 
 go \  n dlv 
 
安装github.com/nsf/gocode FAILED 
安装github.com/uudashr/gopkgs/cmd/gopkgs FAILED 
安装github.com/ramya-rao-a/go-outline FAILED 
安装github.com/  acroca / go-symbols失败
安装golang.org/x/tools/cmd/guru失败
安装golang.org/x/tools/cmd/gorename失败
安装github.com/rogpeppe/godef失败
安装github.com/  sqs / goreturns失败
安装github.com/golang/lint/golint失败
安装github.com/derekparker/delve/cmd/dlv失败
 
10工具无法安装。
 
gocode:
错误:命令失败:  / usr / local / go / bin / go获取-u -v github.com/nsf/gocode
package github.com/nsf/gocode:无法下载,/ home / bitnumbers / go是一个GOROOT  ,而不是GOPATH。 有关更多详细信息,请参见:'go help gopath'
package github.com/nsf/gocode:无法下载,/ home / bitnumbers / go是GOROOT,而不是GOPATH。 有关更多详细信息,请参见:'go help gopath'
   
 
 

请咨询。

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyan6958 2018-04-24 06:01
    已采纳

    As you have pointed out in your comment, on your system echo $GOPATH and echo $GOROOT produce empty output. This indicates an incomplete installation of go. Now, assuming you have installed the go toolchain via the downloads on the website or better yet, gvm, the all there is left to do is make the environment persist the changes across terminal sessions.

    Adding

    export GOPATH=*your path to GOPATH*
    export GOROOT=*path to your go installation*
    

    to your ~/.bashrc, restarting terminal session, restarting VSCode and reattempting to install the tools should do the trick.

    Further reading:

    https://golang.org/doc/install#install

    https://github.com/golang/go/wiki/GOPATH

    https://golang.org/doc/code.html#GOPATH

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题