gpt4 book ai didi

go - 无法在 Visual Studio Code 中安装 Go 扩展

转载 作者:IT王子 更新时间:2023-10-29 02:09:54 26 4
gpt4 key购买 nike

当我尝试在我的 Visual Studio Code 中安装 Go Extension 时,我收到如下错误消息。我在这里遗漏了什么吗?

 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'

请指教。

最佳答案

正如您在评论中指出的那样,在您的系统上echo $GOPATHecho $GOROOT 产生空输出。这表示 go 安装不完整。现在,假设您已经通过网站上的下载安装了 go 工具链,或者更好的是,gvm,那么剩下要做的就是让环境持续更改终端 session 。

添加

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

到您的 ~/.bashrc,重新启动终端 session ,重新启动 VSCode 并重新尝试安装工具应该可以解决问题。

进一步阅读:

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

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

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

关于go - 无法在 Visual Studio Code 中安装 Go 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49992870/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com