VSCode安装go相关插件失败的简单解决方案

2023-12-05 0 888

1. GO环境信息

C:\\Users\\home>go versiongo version go1.18.2 windows/amd64C:\\Users\\home>

安装go插件之后,VSCode开始写代码会提示安装其他插件,错误信息如下:

Installing 8 tools at C:\\Go\\repository\\bin in module mode. gotests gomodifytags impl goplay dlv staticcheck gopls go-outlineInstalling github.com/cweill/gotests/gotests@latest FAILEDInstalling github.com/fatih/gomodifytags@latest FAILEDInstalling github.com/josharian/impl@latest FAILEDInstalling github.com/go-delve/delve/cmd/dlv@latest FAILEDInstalling github.com/haya14busa/goplay/cmd/goplay@latest FAILEDInstalling github.com/go-delve/delve/cmd/dlv@latest FAILEDInstalling honnef.co/go/tools/cmd/staticcheck@latest FAILEDInstalling honnef.co/go/tools/cmd/staticcheck@latest FAILEDInstalling golang.org/x/tools/gopls@latest FAILEDInstalling github.com/ramya-rao-a/go-outline@latest FAILED

无法下载插件只能通过设置GOPROXY代理解决

go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/

修改之后

Installing 8 tools at C:\\Go\\repository\\bin in module mode. gotests gomodifytags impl goplay dlv staticcheck gopls go-outlineInstalling github.com/cweill/gotests/gotests@latest (C:\\Go\\repository\\bin\\gotests.exe) SUCCEEDEDInstalling github.com/fatih/gomodifytags@latest (C:\\Go\\repository\\bin\\gomodifytags.exe) SUCCEEDEDInstalling github.com/josharian/impl@latest (C:\\Go\\repository\\bin\\impl.exe) SUCCEEDEDInstalling github.com/go-delve/delve/cmd/dlv@latest (C:\\Go\\repository\\bin\\dlv.exe) SUCCEEDEDInstalling github.com/haya14busa/goplay/cmd/goplay@latest (C:\\Go\\repository\\bin\\goplay.exe) SUCCEEDEDInstalling github.com/go-delve/delve/cmd/dlv@latest (C:\\Go\\repository\\bin\\dlv.exe) SUCCEEDEDInstalling honnef.co/go/tools/cmd/staticcheck@latest (C:\\Go\\repository\\bin\\staticcheck.exe) SUCCEEDEDInstalling honnef.co/go/tools/cmd/staticcheck@latest (C:\\Go\\repository\\bin\\staticcheck.exe) SUCCEEDEDInstalling golang.org/x/tools/gopls@latest (C:\\Go\\repository\\bin\\gopls.exe) SUCCEEDED1 tools failed to install.impl: failed to install impl(github.com/josharian/impl@latest): Error: Command failed: C:\\Go\\bin\\go.exe install -v github.com/josharian/impl@latestgo: github.com/josharian/impl@latest: module github.com/josharian/impl: reading https://mirrors.aliyun.com/goproxy/github.com/josharian/impl/@v/list: 404 Not FoundInstalling golang.org/x/tools/gopls@latest (C:\\Go\\repository\\bin\\gopls.exe) SUCCEEDEDInstalling github.com/ramya-rao-a/go-outline@latest FAILED{"killed": false,"code": 1,"signal": null,"cmd": "C:\\\\Go\\\\bin\\\\go.exe install -v github.com/ramya-rao-a/go-outline@latest","stdout": "","stderr": "go: github.com/ramya-rao-a/go-outline@latest: no matching versions for query \\"latest\\"\\n"}1 tools failed to install.go-outline: failed to install go-outline(github.com/ramya-rao-a/go-outline@latest): Error: Command failed: C:\\Go\\bin\\go.exe install -v github.com/ramya-rao-a/go-outline@latestgo: github.com/ramya-rao-a/go-outline@latest: no matching versions for query "latest"

还是有一个报错,未能成功安装全部插件,然后切换到%GOPATH%\\pkg\\mod\\github.com目录,例如

C:\\Go\\repository\\pkg\\mod\\github.com

执行如下命令

git clone https://github.com/josharian/impl

然后切换到GOPATH目录,执行如下命令

PS C:\\go\\repository> go install github.com/josharian/impl@latest
PS C:\\go\\repository> go install github.com/ramya-rao-a/go-outline@latest
go: downloading github.com/ramya-rao-a/go-outline v0.0.0-20210608161538-9736a4bde949
go: downloading golang.org/x/tools v0.1.1
PS C:\\go\\repository>

上述命令结束之后,重启VSCode,这下写Go代码就没有问题了。

VSCode安装go相关插件失败的简单解决方案

总结

到此这篇关于VSCode安装go相关插件失败的简单解决方案的文章就介绍到这了,更多相关VSCode安装go插件失败内容请搜索悠久资源网以前的文章或继续浏览下面的相关文章希望大家以后多多支持悠久资源网!

您可能感兴趣的文章:

  • 成功安装vscode中go的相关插件(详细教程)
  • 解决vscode中golang插件依赖安装失败问题
  • go本地环境配置及vscode go插件安装的详细教程
  • MacOS中 VSCode 安装 GO 插件失败问题的快速解决方法
  • 教你一招完美解决vscode安装go插件失败问题

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 Golang VSCode安装go相关插件失败的简单解决方案 https://www.u-9.cn/jiaoben/golang/102192.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务