VSCode无法安装Go工具怎么解决
积累知识,胜过积蓄金银!毕竟在##column_title##开发的过程中,会遇到各种各样的问题,往往都是一些细节知识点还没有掌握好而导致的,因此基础知识点的积累是很重要的。下面本文《VSCode无法安装Go工具怎么解决》,就带大家讲解一下golang知识点,若是你对本文感兴趣,或者是想搞懂其中某个知识点,就请你继续往下看吧~
问题内容
我尝试在 VSCode 中开始使用 Go。我已经安装了 Go 和 Git,并在 Code 中创建了一个项目,其中包含一个.go
文件。
当我输入一些东西时,VSCode 会警告我golint
缺少类似的工具并提示我安装它们。我点击“全部安装”。
然后控制台显示:
Installing 10 tools gocode gopkgs go-outline go-symbols guru gorename godef goreturns golint gotests Installing gocode SUCCEEDED Installing gopkgs SUCCEEDED Installing go-outline SUCCEEDED Installing go-symbols FAILED Installing guru FAILED Installing gorename FAILED Installing godef SUCCEEDED Installing goreturns FAILED Installing golint FAILED Installing gotests FAILED 6 tools failed to install. go-symbols: Error: Command failed: C:Gobingo.exe get -u -v github.com/newhook/go-symbols github.com/newhook/go-symbols (download) Fetching https://golang.org/x/tools/go/buildutil?go-get=1 Parsing meta tags from https://golang.org/x/tools/go/buildutil?go-get=1 (status code 200) get "golang.org/x/tools/go/buildutil": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/buildutil?go-get=1 get "golang.org/x/tools/go/buildutil": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/go/buildutil: exit status 128 github.com/newhook/go-symbols (download) Fetching https://golang.org/x/tools/go/buildutil?go-get=1 Parsing meta tags from https://golang.org/x/tools/go/buildutil?go-get=1 (status code 200) get "golang.org/x/tools/go/buildutil": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/buildutil?go-get=1 get "golang.org/x/tools/go/buildutil": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/go/buildutil: exit status 128 guru: Error: Command failed: C:Gobingo.exe get -u -v golang.org/x/tools/cmd/guru Fetching https://golang.org/x/tools/cmd/guru?go-get=1 Parsing meta tags from https://golang.org/x/tools/cmd/guru?go-get=1 (status code 200) get "golang.org/x/tools/cmd/guru": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/guru?go-get=1 get "golang.org/x/tools/cmd/guru": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/cmd/guru: exit status 128 Fetching https://golang.org/x/tools/cmd/guru?go-get=1 Parsing meta tags from https://golang.org/x/tools/cmd/guru?go-get=1 (status code 200) get "golang.org/x/tools/cmd/guru": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/guru?go-get=1 get "golang.org/x/tools/cmd/guru": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/cmd/guru: exit status 128 gorename: Error: Command failed: C:Gobingo.exe get -u -v golang.org/x/tools/cmd/gorename Fetching https://golang.org/x/tools/cmd/gorename?go-get=1 Parsing meta tags from https://golang.org/x/tools/cmd/gorename?go-get=1 (status code 200) get "golang.org/x/tools/cmd/gorename": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/gorename?go-get=1 get "golang.org/x/tools/cmd/gorename": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/cmd/gorename: exit status 128 Fetching https://golang.org/x/tools/cmd/gorename?go-get=1 Parsing meta tags from https://golang.org/x/tools/cmd/gorename?go-get=1 (status code 200) get "golang.org/x/tools/cmd/gorename": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/cmd/gorename?go-get=1 get "golang.org/x/tools/cmd/gorename": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/cmd/gorename: exit status 128 goreturns: Error: Command failed: C:Gobingo.exe get -u -v sourcegraph.com/sqs/goreturns Fetching https://sourcegraph.com/sqs/goreturns?go-get=1 Parsing meta tags from https://sourcegraph.com/sqs/goreturns?go-get=1 (status code 200) get "sourcegraph.com/sqs/goreturns": found meta tag main.metaImport{Prefix:"sourcegraph.com/sqs/goreturns", VCS:"git", RepoRoot:"https://github.com/sqs/goreturns"} at https://sourcegraph.com/sqs/goreturns?go-get=1 sourcegraph.com/sqs/goreturns (download) github.com/sqs/goreturns (download) Fetching https://golang.org/x/tools/imports?go-get=1 Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200) get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1 get "golang.org/x/tools/imports": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/imports: exit status 128 Fetching https://sourcegraph.com/sqs/goreturns?go-get=1 Parsing meta tags from https://sourcegraph.com/sqs/goreturns?go-get=1 (status code 200) get "sourcegraph.com/sqs/goreturns": found meta tag main.metaImport{Prefix:"sourcegraph.com/sqs/goreturns", VCS:"git", RepoRoot:"https://github.com/sqs/goreturns"} at https://sourcegraph.com/sqs/goreturns?go-get=1 sourcegraph.com/sqs/goreturns (download) github.com/sqs/goreturns (download) Fetching https://golang.org/x/tools/imports?go-get=1 Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200) get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1 get "golang.org/x/tools/imports": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/imports: exit status 128 golint: Error: Command failed: C:Gobingo.exe get -u -v github.com/golang/lint/golint github.com/golang/lint (download) Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1 Parsing meta tags from https://golang.org/x/tools/go/gcexportdata?go-get=1 (status code 200) get "golang.org/x/tools/go/gcexportdata": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/gcexportdata?go-get=1 get "golang.org/x/tools/go/gcexportdata": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/go/gcexportdata: exit status 128 github.com/golang/lint (download) Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1 Parsing meta tags from https://golang.org/x/tools/go/gcexportdata?go-get=1 (status code 200) get "golang.org/x/tools/go/gcexportdata": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/gcexportdata?go-get=1 get "golang.org/x/tools/go/gcexportdata": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/go/gcexportdata: exit status 128 gotests: Error: Command failed: C:Gobingo.exe get -u -v github.com/cweill/gotests/... github.com/cweill/gotests (download) Fetching https://golang.org/x/tools/imports?go-get=1 Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200) get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1 get "golang.org/x/tools/imports": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/imports: exit status 128 github.com/cweill/gotests (download) Fetching https://golang.org/x/tools/imports?go-get=1 Parsing meta tags from https://golang.org/x/tools/imports?go-get=1 (status code 200) get "golang.org/x/tools/imports": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/imports?go-get=1 get "golang.org/x/tools/imports": verifying non-authoritative meta tag Fetching https://golang.org/x/tools?go-get=1 Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200) golang.org/x/tools (download) # cd C:Usersusergosrcgolang.orgxtools; git pull --ff-only fatal: Not a git repository (or any of the parent directories): .git package golang.org/x/tools/imports: exit status 128
有些工具可以安装,有些则不能。我对这个错误无能为力,Not a git repository
因为它是一个自动化过程,而且我不是输入 git 命令的人。
我尝试在 PowerShell 中单独安装这些工具,但我得到了同样的错误。我的 go 目录已创建(在
中%USERPROFILE%go
)并且GOPATH
设置正确。
有任何想法吗 ?
正确答案
看起来它因为C:Usersusergosrcgolang.orgxtools
不是 git repo
而在抱怨,所以它无法更新其中的任何内容。
假设您没有将自己的代码放在该目录中,请尝试将其删除然后再次运行。
如果您查看 Go 插件的文档,并一直滚动到底部,如果您想手动安装/升级插件所需的东西,它会显示要运行的命令。
具体来说,取自[他们的 github repo](https://github.com/Microsoft/vscode-go#tools-this- extension-depends-on),您可以从 cmd.exe 提示符下运行它。
go get -u -v github.com/nsf/gocode go get -u -v github.com/rogpeppe/godef go get -u -v github.com/zmb3/gogetdoc go get -u -v github.com/golang/lint/golint go get -u -v github.com/lukehoban/go-outline go get -u -v sourcegraph.com/sqs/goreturns go get -u -v golang.org/x/tools/cmd/gorename go get -u -v github.com/tpng/gopkgs go get -u -v github.com/newhook/go-symbols go get -u -v golang.org/x/tools/cmd/guru go get -u -v github.com/cweill/gotests/... go get -u -v golang.org/x/tools/cmd/godoc go get -u -v github.com/fatih/gomodifytags
今天关于《VSCode无法安装Go工具怎么解决》的内容就介绍到这里了,是不是学起来一目了然!想要了解更多关于golang的内容请关注golang学习网公众号!

- 上一篇
- golang TCPConn.SetWriteDeadline doesn't seem to work as expected

- 下一篇
- Golang xml.Unmarshal 接口类型
-
- 坚强的奇迹
- 这篇文章太及时了,太详细了,真优秀,已收藏,关注大佬了!希望大佬能多写Golang相关的文章。
- 2023-04-16 13:45:31
-
- 生动的钢笔
- 这篇文章真及时,太详细了,受益颇多,收藏了,关注博主了!希望博主能多写Golang相关的文章。
- 2023-04-14 13:47:10
-
- 懦弱的火车
- 真优秀,一直没懂这个问题,但其实工作中常常有遇到...不过今天到这,看完之后很有帮助,总算是懂了,感谢作者大大分享技术贴!
- 2023-04-13 09:21:01
-
- Golang · Go问答 | 1年前 |
- 在读取缓冲通道中的内容之前退出
- 139浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 戈兰岛的全球 GOPRIVATE 设置
- 204浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何将结构作为参数传递给 xml-rpc
- 325浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何用golang获得小数点以下两位长度?
- 477浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何通过 client-go 和 golang 检索 Kubernetes 指标
- 486浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 将多个“参数”映射到单个可变参数的习惯用法
- 439浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 将 HTTP 响应正文写入文件后出现 EOF 错误
- 357浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 结构中映射的匿名列表的“复合文字中缺少类型”
- 352浏览 收藏
-
- Golang · Go问答 | 1年前 |
- NATS Jetstream 的性能
- 101浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何将复杂的字符串输入转换为mapstring?
- 440浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 相当于GoLang中Java将Object作为方法参数传递
- 212浏览 收藏
-
- Golang · Go问答 | 1年前 |
- 如何确保所有 goroutine 在没有 time.Sleep 的情况下终止?
- 143浏览 收藏
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 542次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 508次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 497次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 484次学习
-
- 笔灵AI生成答辩PPT
- 探索笔灵AI生成答辩PPT的强大功能,快速制作高质量答辩PPT。精准内容提取、多样模板匹配、数据可视化、配套自述稿生成,让您的学术和职场展示更加专业与高效。
- 28次使用
-
- 知网AIGC检测服务系统
- 知网AIGC检测服务系统,专注于检测学术文本中的疑似AI生成内容。依托知网海量高质量文献资源,结合先进的“知识增强AIGC检测技术”,系统能够从语言模式和语义逻辑两方面精准识别AI生成内容,适用于学术研究、教育和企业领域,确保文本的真实性和原创性。
- 42次使用
-
- AIGC检测-Aibiye
- AIbiye官网推出的AIGC检测服务,专注于检测ChatGPT、Gemini、Claude等AIGC工具生成的文本,帮助用户确保论文的原创性和学术规范。支持txt和doc(x)格式,检测范围为论文正文,提供高准确性和便捷的用户体验。
- 39次使用
-
- 易笔AI论文
- 易笔AI论文平台提供自动写作、格式校对、查重检测等功能,支持多种学术领域的论文生成。价格优惠,界面友好,操作简便,适用于学术研究者、学生及论文辅导机构。
- 51次使用
-
- 笔启AI论文写作平台
- 笔启AI论文写作平台提供多类型论文生成服务,支持多语言写作,满足学术研究者、学生和职场人士的需求。平台采用AI 4.0版本,确保论文质量和原创性,并提供查重保障和隐私保护。
- 42次使用
-
- 老师代码没有自动跟踪?
- 2023-03-07 439浏览
-
- c程序fork并等待golang进程状态
- 2023-03-05 262浏览
-
- GOLANG使用Context管理关联goroutine的方法
- 2022-12-28 193浏览
-
- 怎么用Golang将MySQL表转储为JSON
- 2023-03-07 188浏览
-
- Golang 检查字符串是否为有效路径?
- 2023-03-10 500浏览