vim-go 找不到正确的 GOPATH
vim-go can not find correct GOPATH
当我在Vim
中安装vim-进入sudo用户下
: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^@
vim-go: godef not found. Installing github.com/rogpeppe/godef to folder /usr/local/go/bin
Error installing github.com/rogpeppe/godef: go build github.com/rogpeppe/godef: open /usr/local/go/bin/godef: permission denied^@
vim-go: motion not found. Installing github.com/fatih/motion to folder /usr/local/go/bin
Error installing github.com/fatih/motion: go build github.com/fatih/motion: open /usr/local/go/bin/motion: permission denied^@
vim-go: errcheck not found. Installing github.com/kisielk/errcheck to folder /usr/local/go/bin
Error installing github.com/kisielk/errcheck: go build github.com/kisielk/errcheck: open /usr/local/go/bin/errcheck: permission denied^@
vim-go: dlv not found. Installing github.com/derekparker/delve/cmd/dlv to folder /usr/local/go/bin
Error downloading github.com/derekparker/delve/cmd/dlv: github.com/derekparker/delve (download)^@# cd /home/fred/go/src/github.com/derekparker/delve; git pull --ff-only^
@error: cannot open .git/FETCH_HEAD: Permission denied^@^@package github.com/derekparker/delve/cmd/dlv: exit status 1^@
Error installing github.com/derekparker/delve/cmd/dlv: go build github.com/derekparker/delve/cmd/dlv: open /usr/local/go/bin/dlv: permission denied^@
vim-go: gocode not found. Installing github.com/mdempsky/gocode to folder /usr/local/go/bin
Error installing github.com/mdempsky/gocode: go build github.com/mdempsky/gocode: open /usr/local/go/bin/gocode: permission denied^@
vim-go: impl not found. Installing github.com/josharian/impl to folder /usr/local/go/bin
Error installing github.com/josharian/impl: go build github.com/josharian/impl: open /usr/local/go/bin/impl: permission denied^@
vim-go: iferr not found. Installing github.com/koron/iferr to folder /usr/local/go/bin
Error installing github.com/koron/iferr: go build github.com/koron/iferr: open /usr/local/go/bin/iferr: permission denied^@
vim-go: gotags not found. Installing github.com/jstemmer/gotags to folder /usr/local/go/bin
Error installing github.com/jstemmer/gotags: go build github.com/jstemmer/gotags: open /usr/local/go/bin/gotags: permission denied^@
vim-go: gorename not found. Installing golang.org/x/tools/cmd/gorename to folder /usr/local/go/bin
Error installing golang.org/x/tools/cmd/gorename: go build golang.org/x/tools/cmd/gorename: open /usr/local/go/bin/gorename: permission denied^@
vim-go: goimports not found. Installing golang.org/x/tools/cmd/goimports to folder /usr/local/go/bin
Error installing golang.org/x/tools/cmd/goimports: go build golang.org/x/tools/cmd/goimports: open /usr/local/go/bin/goimports: permission denied^@
vim-go: gocode-gomod not found. Installing github.com/stamblerre/gocode to folder /usr/local/go/bin
Error installing github.com/stamblerre/gocode: go build github.com/stamblerre/gocode: open /usr/local/go/bin/gocode-gomod: permission denied^@
vim-go: gomodifytags not found. Installing github.com/fatih/gomodifytags to folder /usr/local/go/bin
Error installing github.com/fatih/gomodifytags: go build github.com/fatih/gomodifytags: open /usr/local/go/bin/gomodifytags: permission denied^@
vim-go: keyify not found. Installing honnef.co/go/tools/cmd/keyify to folder /usr/local/go/bin
Error installing honnef.co/go/tools/cmd/keyify: go build honnef.co/go/tools/cmd/keyify: open /usr/local/go/bin/keyify: permission denied^@
vim-go: asmfmt not found. Installing github.com/klauspost/asmfmt/cmd/asmfmt to folder /usr/local/go/bin
Error installing github.com/klauspost/asmfmt/cmd/asmfmt: go build github.com/klauspost/asmfmt/cmd/asmfmt: open /usr/local/go/bin/asmfmt: permission denied^@
vim-go: gometalinter not found. Installing github.com/alecthomas/gometalinter to folder /usr/local/go/bin
Error installing github.com/alecthomas/gometalinter: go build github.com/alecthomas/gometalinter: open /usr/local/go/bin/gometalinter: permission denied^@
vim-go: installing finished!
$GOPATH 是:
/home/fred/go:/home/fred/folder1:/home/fred/folder2
为什么 vim - 将二进制文件安装到
/usr/local/go/bin
# sudo user permisson denied.
不是 $GOPATH 中的第一个路径:
/home/fred/go
sudo chown $LOGNAME /usr/local/go/bin
然后重试
这将修复权限
我遇到了同样的问题
我在 ~./vimrc 中设置 go_bin_path
来解决这个问题
let g:go_bin_path = $HOME."/go/bin"
当我在Vim
中安装vim-进入sudo用户下: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^@
vim-go: godef not found. Installing github.com/rogpeppe/godef to folder /usr/local/go/bin
Error installing github.com/rogpeppe/godef: go build github.com/rogpeppe/godef: open /usr/local/go/bin/godef: permission denied^@
vim-go: motion not found. Installing github.com/fatih/motion to folder /usr/local/go/bin
Error installing github.com/fatih/motion: go build github.com/fatih/motion: open /usr/local/go/bin/motion: permission denied^@
vim-go: errcheck not found. Installing github.com/kisielk/errcheck to folder /usr/local/go/bin
Error installing github.com/kisielk/errcheck: go build github.com/kisielk/errcheck: open /usr/local/go/bin/errcheck: permission denied^@
vim-go: dlv not found. Installing github.com/derekparker/delve/cmd/dlv to folder /usr/local/go/bin
Error downloading github.com/derekparker/delve/cmd/dlv: github.com/derekparker/delve (download)^@# cd /home/fred/go/src/github.com/derekparker/delve; git pull --ff-only^
@error: cannot open .git/FETCH_HEAD: Permission denied^@^@package github.com/derekparker/delve/cmd/dlv: exit status 1^@
Error installing github.com/derekparker/delve/cmd/dlv: go build github.com/derekparker/delve/cmd/dlv: open /usr/local/go/bin/dlv: permission denied^@
vim-go: gocode not found. Installing github.com/mdempsky/gocode to folder /usr/local/go/bin
Error installing github.com/mdempsky/gocode: go build github.com/mdempsky/gocode: open /usr/local/go/bin/gocode: permission denied^@
vim-go: impl not found. Installing github.com/josharian/impl to folder /usr/local/go/bin
Error installing github.com/josharian/impl: go build github.com/josharian/impl: open /usr/local/go/bin/impl: permission denied^@
vim-go: iferr not found. Installing github.com/koron/iferr to folder /usr/local/go/bin
Error installing github.com/koron/iferr: go build github.com/koron/iferr: open /usr/local/go/bin/iferr: permission denied^@
vim-go: gotags not found. Installing github.com/jstemmer/gotags to folder /usr/local/go/bin
Error installing github.com/jstemmer/gotags: go build github.com/jstemmer/gotags: open /usr/local/go/bin/gotags: permission denied^@
vim-go: gorename not found. Installing golang.org/x/tools/cmd/gorename to folder /usr/local/go/bin
Error installing golang.org/x/tools/cmd/gorename: go build golang.org/x/tools/cmd/gorename: open /usr/local/go/bin/gorename: permission denied^@
vim-go: goimports not found. Installing golang.org/x/tools/cmd/goimports to folder /usr/local/go/bin
Error installing golang.org/x/tools/cmd/goimports: go build golang.org/x/tools/cmd/goimports: open /usr/local/go/bin/goimports: permission denied^@
vim-go: gocode-gomod not found. Installing github.com/stamblerre/gocode to folder /usr/local/go/bin
Error installing github.com/stamblerre/gocode: go build github.com/stamblerre/gocode: open /usr/local/go/bin/gocode-gomod: permission denied^@
vim-go: gomodifytags not found. Installing github.com/fatih/gomodifytags to folder /usr/local/go/bin
Error installing github.com/fatih/gomodifytags: go build github.com/fatih/gomodifytags: open /usr/local/go/bin/gomodifytags: permission denied^@
vim-go: keyify not found. Installing honnef.co/go/tools/cmd/keyify to folder /usr/local/go/bin
Error installing honnef.co/go/tools/cmd/keyify: go build honnef.co/go/tools/cmd/keyify: open /usr/local/go/bin/keyify: permission denied^@
vim-go: asmfmt not found. Installing github.com/klauspost/asmfmt/cmd/asmfmt to folder /usr/local/go/bin
Error installing github.com/klauspost/asmfmt/cmd/asmfmt: go build github.com/klauspost/asmfmt/cmd/asmfmt: open /usr/local/go/bin/asmfmt: permission denied^@
vim-go: gometalinter not found. Installing github.com/alecthomas/gometalinter to folder /usr/local/go/bin
Error installing github.com/alecthomas/gometalinter: go build github.com/alecthomas/gometalinter: open /usr/local/go/bin/gometalinter: permission denied^@
vim-go: installing finished!
$GOPATH 是:
/home/fred/go:/home/fred/folder1:/home/fred/folder2
为什么 vim - 将二进制文件安装到
/usr/local/go/bin
# sudo user permisson denied.
不是 $GOPATH 中的第一个路径:
/home/fred/go
sudo chown $LOGNAME /usr/local/go/bin
然后重试
这将修复权限
我遇到了同样的问题
我在 ~./vimrc 中设置 go_bin_path
来解决这个问题
let g:go_bin_path = $HOME."/go/bin"