Dav*_*idB 1 go visual-studio-code
当我尝试在 Visual Studio Code 中安装 Go 扩展时,我收到如下错误消息。我在这里错过了什么吗?
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'
Run Code Online (Sandbox Code Playgroud)
请指教。
正如您在评论中指出的那样,在您的系统上
echo $GOPATH并echo $GOROOT产生空输出。这表明 的安装不完整go。现在,假设您已经go通过网站上的下载或更好的方式安装了工具链,那么gvm剩下要做的就是使环境在终端会话之间保持更改。
添加
export GOPATH=*your path to GOPATH*
export GOROOT=*path to your go installation*
Run Code Online (Sandbox Code Playgroud)
到你的~/.bashrc,重新启动终端会话,重新启动 VSCode 并重新尝试安装工具应该可以解决问题。
进一步阅读:
https://golang.org/doc/install#install
https://github.com/golang/go/wiki/GOPATH
https://golang.org/doc/code.html#GOPATH
| 归档时间: |
|
| 查看次数: |
18504 次 |
| 最近记录: |