猿问

vim-go 找不到正确的 GOPATH

当我在 Vim 的 sudo 用户下安装 vim-go 时


:GoInstallBinaries

它报告错误:


vim-go: gogetdoc not found. Installing github.com/zmb3/gogetdoc to folder /usr/local/go/bin

Error installing github.com/zmb3/gogetdoc: go build github.com/zmb3/gogetdoc: open /usr/local/go/bin/gogetdoc: permission denied^@

vim-go: guru not found. Installing golang.org/x/tools/cmd/guru to folder /usr/local/go/bin

Error installing golang.org/x/tools/cmd/guru: go build golang.org/x/tools/cmd/guru: open /usr/local/go/bin/guru: permission denied^@

vim-go: golint not found. Installing golang.org/x/lint/golint to folder /usr/local/go/bin

Error installing golang.org/x/lint/golint: go build golang.org/x/lint/golint: open /usr/local/go/bin/golint: permission denied^@

vim-go: fillstruct not found. Installing github.com/davidrjenni/reftools/cmd/fillstruct to folder /usr/local/go/bin

Error installing github.com/davidrjenni/reftools/cmd/fillstruct: go build github.com/davidrjenni/reftools/cmd/fillstruct: open /usr/local/go/bin/fillstruct: permission d

enied^@

$GOPATH 是:

/home/fred/go:/home/fred/folder1:/home/fred/folder2

为什么 vim-go 安装二进制文件到

/usr/local/go/bin
# sudo 用户权限被拒绝。

不是 $GOPATH 中的第一条路径:

/家/弗雷德/去


隔江千里
浏览 137回答 2
2回答

BIG阳

我遇到了同样的问题。我在 ~./vimrc 中设置go_bin_path如下来解决这个问题let g:go_bin_path = $HOME."/go/bin"

米脂

sudo chown $LOGNAME /usr/local/go/bin然后再试一次这将修复权限
随时随地看视频慕课网APP

相关分类

Go
我要回答