vim-go 找不到正确的 GOPATH
来源:stackoverflow
时间:2024-04-15 08:36:37 500浏览 收藏
学习知识要善于思考,思考,再思考!今天golang学习网小编就给大家带来《vim-go 找不到正确的 GOPATH》,以下内容主要包含等知识点,如果你正在学习或准备学习Golang,就都不要错过本文啦~让我们一起来看看吧,能帮助到你就更好了!
问题内容
当我在 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^@ 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-go 将二进制文件安装到
/usr/local/go/bin # sudo 用户权限被拒绝。
不是 $gopath 中的第一个路径:
/家/弗雷德/去
解决方案
我遇到了同样的问题。
我在 ~./vimrc 中设置了 go_bin_path
来修复此问题
let g:go_bin_path = $home."/go/bin"
sudo chown $LOGNAME /usr/local/go/bin
然后再试一次
这将修复权限
今天关于《vim-go 找不到正确的 GOPATH》的内容就介绍到这里了,是不是学起来一目了然!想要了解更多关于的内容请关注golang学习网公众号!
声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
-
502 收藏
-
502 收藏
-
501 收藏
-
501 收藏
-
501 收藏
最新阅读
更多>
-
139 收藏
-
204 收藏
-
325 收藏
-
477 收藏
-
486 收藏
-
439 收藏
课程推荐
更多>
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 立即学习 542次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 立即学习 507次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 立即学习 497次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 立即学习 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 立即学习 484次学习