vim-go can not find correct GOPATH











up vote
0
down vote

favorite












When I install vim-go under sudo user in Vim



:GoInstallBinaries


It report errors:



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!


and $GOPATH is:



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


Why vim-go install binaries to




/usr/local/go/bin

# sudo user permisson denied.




not the first path in $GOPATH:




/home/fred/go











share|improve this question


















  • 1




    Unless you ran sudo with the -E option, the GOPATH environment variable was not passed to the executed command. You can try using the sudo -E flag to fix the problem, but it's probably better to not use sudo at all.
    – ThunderCat
    Nov 13 at 7:17












  • Is your GOPATH env variable exported ? Can you run env | grep GOPATH to verify if it shows any output ? Does the :GoPath command within vim show what you expect ?
    – nos
    Nov 13 at 15:06












  • I can print value of GOPATH by :GoPath in vim.
    – Fred
    Nov 14 at 1:57










  • I know the way how to pass $GOPATH from myuser to root. sudo env "PATH=$PATH" go get -u github.com/derekparker/delve/cmd/dlv, and problem is not the root can not get gopath, is myuser have no permisson access some system folder and Seemingly I can not use sudo in vim command line. iIt's not convenient to use sudo in some situation but always has no choice.
    – Fred
    Nov 14 at 2:04

















up vote
0
down vote

favorite












When I install vim-go under sudo user in Vim



:GoInstallBinaries


It report errors:



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!


and $GOPATH is:



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


Why vim-go install binaries to




/usr/local/go/bin

# sudo user permisson denied.




not the first path in $GOPATH:




/home/fred/go











share|improve this question


















  • 1




    Unless you ran sudo with the -E option, the GOPATH environment variable was not passed to the executed command. You can try using the sudo -E flag to fix the problem, but it's probably better to not use sudo at all.
    – ThunderCat
    Nov 13 at 7:17












  • Is your GOPATH env variable exported ? Can you run env | grep GOPATH to verify if it shows any output ? Does the :GoPath command within vim show what you expect ?
    – nos
    Nov 13 at 15:06












  • I can print value of GOPATH by :GoPath in vim.
    – Fred
    Nov 14 at 1:57










  • I know the way how to pass $GOPATH from myuser to root. sudo env "PATH=$PATH" go get -u github.com/derekparker/delve/cmd/dlv, and problem is not the root can not get gopath, is myuser have no permisson access some system folder and Seemingly I can not use sudo in vim command line. iIt's not convenient to use sudo in some situation but always has no choice.
    – Fred
    Nov 14 at 2:04















up vote
0
down vote

favorite









up vote
0
down vote

favorite











When I install vim-go under sudo user in Vim



:GoInstallBinaries


It report errors:



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!


and $GOPATH is:



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


Why vim-go install binaries to




/usr/local/go/bin

# sudo user permisson denied.




not the first path in $GOPATH:




/home/fred/go











share|improve this question













When I install vim-go under sudo user in Vim



:GoInstallBinaries


It report errors:



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!


and $GOPATH is:



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


Why vim-go install binaries to




/usr/local/go/bin

# sudo user permisson denied.




not the first path in $GOPATH:




/home/fred/go








go vim vim-plugin






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 at 7:07









Fred

214




214








  • 1




    Unless you ran sudo with the -E option, the GOPATH environment variable was not passed to the executed command. You can try using the sudo -E flag to fix the problem, but it's probably better to not use sudo at all.
    – ThunderCat
    Nov 13 at 7:17












  • Is your GOPATH env variable exported ? Can you run env | grep GOPATH to verify if it shows any output ? Does the :GoPath command within vim show what you expect ?
    – nos
    Nov 13 at 15:06












  • I can print value of GOPATH by :GoPath in vim.
    – Fred
    Nov 14 at 1:57










  • I know the way how to pass $GOPATH from myuser to root. sudo env "PATH=$PATH" go get -u github.com/derekparker/delve/cmd/dlv, and problem is not the root can not get gopath, is myuser have no permisson access some system folder and Seemingly I can not use sudo in vim command line. iIt's not convenient to use sudo in some situation but always has no choice.
    – Fred
    Nov 14 at 2:04
















  • 1




    Unless you ran sudo with the -E option, the GOPATH environment variable was not passed to the executed command. You can try using the sudo -E flag to fix the problem, but it's probably better to not use sudo at all.
    – ThunderCat
    Nov 13 at 7:17












  • Is your GOPATH env variable exported ? Can you run env | grep GOPATH to verify if it shows any output ? Does the :GoPath command within vim show what you expect ?
    – nos
    Nov 13 at 15:06












  • I can print value of GOPATH by :GoPath in vim.
    – Fred
    Nov 14 at 1:57










  • I know the way how to pass $GOPATH from myuser to root. sudo env "PATH=$PATH" go get -u github.com/derekparker/delve/cmd/dlv, and problem is not the root can not get gopath, is myuser have no permisson access some system folder and Seemingly I can not use sudo in vim command line. iIt's not convenient to use sudo in some situation but always has no choice.
    – Fred
    Nov 14 at 2:04










1




1




Unless you ran sudo with the -E option, the GOPATH environment variable was not passed to the executed command. You can try using the sudo -E flag to fix the problem, but it's probably better to not use sudo at all.
– ThunderCat
Nov 13 at 7:17






Unless you ran sudo with the -E option, the GOPATH environment variable was not passed to the executed command. You can try using the sudo -E flag to fix the problem, but it's probably better to not use sudo at all.
– ThunderCat
Nov 13 at 7:17














Is your GOPATH env variable exported ? Can you run env | grep GOPATH to verify if it shows any output ? Does the :GoPath command within vim show what you expect ?
– nos
Nov 13 at 15:06






Is your GOPATH env variable exported ? Can you run env | grep GOPATH to verify if it shows any output ? Does the :GoPath command within vim show what you expect ?
– nos
Nov 13 at 15:06














I can print value of GOPATH by :GoPath in vim.
– Fred
Nov 14 at 1:57




I can print value of GOPATH by :GoPath in vim.
– Fred
Nov 14 at 1:57












I know the way how to pass $GOPATH from myuser to root. sudo env "PATH=$PATH" go get -u github.com/derekparker/delve/cmd/dlv, and problem is not the root can not get gopath, is myuser have no permisson access some system folder and Seemingly I can not use sudo in vim command line. iIt's not convenient to use sudo in some situation but always has no choice.
– Fred
Nov 14 at 2:04






I know the way how to pass $GOPATH from myuser to root. sudo env "PATH=$PATH" go get -u github.com/derekparker/delve/cmd/dlv, and problem is not the root can not get gopath, is myuser have no permisson access some system folder and Seemingly I can not use sudo in vim command line. iIt's not convenient to use sudo in some situation but always has no choice.
– Fred
Nov 14 at 2:04














2 Answers
2






active

oldest

votes

















up vote
0
down vote













I met the same problem.



I set the go_bin_path as below in ~./vimrc to fix this



let g:go_bin_path = $HOME."/go/bin"






share|improve this answer




























    up vote
    -1
    down vote













    sudo chown $LOGNAME /usr/local/go/bin


    And try again



    That will fix the permissions






    share|improve this answer





















    • This is the sledgehammer approach. Don't do it, normal users shouldn't own stuff in that location.
      – nos
      Nov 13 at 15:02










    • Actually, it's /usr/local, it's my laptop, I am the normal user why would I need root privs? root means the owner of / not /usr/local. Sorry @nos I can't agree
      – Vorsprung
      Nov 13 at 15:33










    • The root user is normally the default owner of / , /usr/ /usr/local /etc. and other places in the filesystem hierarchy. Once you start messing with the default ownerships within these standard directories, you' can easily create a mess.
      – nos
      Nov 13 at 15:35











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275602%2fvim-go-can-not-find-correct-gopath%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    I met the same problem.



    I set the go_bin_path as below in ~./vimrc to fix this



    let g:go_bin_path = $HOME."/go/bin"






    share|improve this answer

























      up vote
      0
      down vote













      I met the same problem.



      I set the go_bin_path as below in ~./vimrc to fix this



      let g:go_bin_path = $HOME."/go/bin"






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        I met the same problem.



        I set the go_bin_path as below in ~./vimrc to fix this



        let g:go_bin_path = $HOME."/go/bin"






        share|improve this answer












        I met the same problem.



        I set the go_bin_path as below in ~./vimrc to fix this



        let g:go_bin_path = $HOME."/go/bin"







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 at 22:54









        Browny Lin

        1,2361428




        1,2361428
























            up vote
            -1
            down vote













            sudo chown $LOGNAME /usr/local/go/bin


            And try again



            That will fix the permissions






            share|improve this answer





















            • This is the sledgehammer approach. Don't do it, normal users shouldn't own stuff in that location.
              – nos
              Nov 13 at 15:02










            • Actually, it's /usr/local, it's my laptop, I am the normal user why would I need root privs? root means the owner of / not /usr/local. Sorry @nos I can't agree
              – Vorsprung
              Nov 13 at 15:33










            • The root user is normally the default owner of / , /usr/ /usr/local /etc. and other places in the filesystem hierarchy. Once you start messing with the default ownerships within these standard directories, you' can easily create a mess.
              – nos
              Nov 13 at 15:35















            up vote
            -1
            down vote













            sudo chown $LOGNAME /usr/local/go/bin


            And try again



            That will fix the permissions






            share|improve this answer





















            • This is the sledgehammer approach. Don't do it, normal users shouldn't own stuff in that location.
              – nos
              Nov 13 at 15:02










            • Actually, it's /usr/local, it's my laptop, I am the normal user why would I need root privs? root means the owner of / not /usr/local. Sorry @nos I can't agree
              – Vorsprung
              Nov 13 at 15:33










            • The root user is normally the default owner of / , /usr/ /usr/local /etc. and other places in the filesystem hierarchy. Once you start messing with the default ownerships within these standard directories, you' can easily create a mess.
              – nos
              Nov 13 at 15:35













            up vote
            -1
            down vote










            up vote
            -1
            down vote









            sudo chown $LOGNAME /usr/local/go/bin


            And try again



            That will fix the permissions






            share|improve this answer












            sudo chown $LOGNAME /usr/local/go/bin


            And try again



            That will fix the permissions







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 13 at 14:57









            Vorsprung

            21.6k31941




            21.6k31941












            • This is the sledgehammer approach. Don't do it, normal users shouldn't own stuff in that location.
              – nos
              Nov 13 at 15:02










            • Actually, it's /usr/local, it's my laptop, I am the normal user why would I need root privs? root means the owner of / not /usr/local. Sorry @nos I can't agree
              – Vorsprung
              Nov 13 at 15:33










            • The root user is normally the default owner of / , /usr/ /usr/local /etc. and other places in the filesystem hierarchy. Once you start messing with the default ownerships within these standard directories, you' can easily create a mess.
              – nos
              Nov 13 at 15:35


















            • This is the sledgehammer approach. Don't do it, normal users shouldn't own stuff in that location.
              – nos
              Nov 13 at 15:02










            • Actually, it's /usr/local, it's my laptop, I am the normal user why would I need root privs? root means the owner of / not /usr/local. Sorry @nos I can't agree
              – Vorsprung
              Nov 13 at 15:33










            • The root user is normally the default owner of / , /usr/ /usr/local /etc. and other places in the filesystem hierarchy. Once you start messing with the default ownerships within these standard directories, you' can easily create a mess.
              – nos
              Nov 13 at 15:35
















            This is the sledgehammer approach. Don't do it, normal users shouldn't own stuff in that location.
            – nos
            Nov 13 at 15:02




            This is the sledgehammer approach. Don't do it, normal users shouldn't own stuff in that location.
            – nos
            Nov 13 at 15:02












            Actually, it's /usr/local, it's my laptop, I am the normal user why would I need root privs? root means the owner of / not /usr/local. Sorry @nos I can't agree
            – Vorsprung
            Nov 13 at 15:33




            Actually, it's /usr/local, it's my laptop, I am the normal user why would I need root privs? root means the owner of / not /usr/local. Sorry @nos I can't agree
            – Vorsprung
            Nov 13 at 15:33












            The root user is normally the default owner of / , /usr/ /usr/local /etc. and other places in the filesystem hierarchy. Once you start messing with the default ownerships within these standard directories, you' can easily create a mess.
            – nos
            Nov 13 at 15:35




            The root user is normally the default owner of / , /usr/ /usr/local /etc. and other places in the filesystem hierarchy. Once you start messing with the default ownerships within these standard directories, you' can easily create a mess.
            – nos
            Nov 13 at 15:35


















             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275602%2fvim-go-can-not-find-correct-gopath%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?