英文:
I am getting some errors in installing go tools for vscode
问题
我正在尝试为Go语言设置我的Visual Studio Code,但在安装gopls和go-outline时遇到了一些错误。
错误信息如下:
安装github.com/ramya-rao-a/go-outline@latest失败
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "C:\Program Files\Go\bin\go.exe install -v github.com/ramya-rao-a/go-outline@latest",
"stdout": "",
"stderr": "C:\Users\harsh\go\pkg\mod\github.com\ramya-rao-a\go-outline@v0.0.0-20210608161538-9736a4bde949\main.go:14:2: read C:\Users\harsh\go\pkg\mod\golang.org\x\tools@v0.1.1\go\buildutil\allpackages.go: unexpected NUL in input\n"
}
安装golang.org/x/tools/gopls@latest失败
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "C:\Program Files\Go\bin\go.exe install -v golang.org/x/tools/gopls@latest",
"stdout": "",
"stderr": "go: downloading golang.org/x/tools v0.1.11-0.20220407163324-91bcfb1bdf9c\nverifying github.com/sergi/go-diff@v1.1.0: zip: not a valid zip file\n"
}
错误截图如下:
1: https://i.stack.imgur.com/LRTPT.png
是否有其他安装这些工具的方法?
英文:
I am trying to setup my visual studio code for go language. but i am getting some errors in installing gopls and go-outline.
errors
Installing github.com/ramya-rao-a/go-outline@latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "C:\\Program Files\\Go\\bin\\go.exe install -v github.com/ramya-rao-a/go-outline@latest",
"stdout": "",
"stderr": "C:\\Users\\harsh\\go\\pkg\\mod\\github.com\\ramya-rao-a\\go-outline@v0.0.0-20210608161538-9736a4bde949\\main.go:14:2: read C:\\Users\\harsh\\go\\pkg\\mod\\golang.org\\x\\tools@v0.1.1\\go\\buildutil\\allpackages.go: unexpected NUL in input\n"
}
Installing golang.org/x/tools/gopls@latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "C:\\Program Files\\Go\\bin\\go.exe install -v golang.org/x/tools/gopls@latest",
"stdout": "",
"stderr": "go: downloading golang.org/x/tools v0.1.11-0.20220407163324-91bcfb1bdf9c\nverifying github.com/sergi/go-diff@v1.1.0: zip: not a valid zip file\n"
}
the screenshot of the errors.
Is there any other way to install this tools ?
答案1
得分: 1
尝试使用以下命令进行操作:
go env -w GO111MODULE=on
然后执行以下命令清理模块缓存:
go clean -modcache
最后重新安装即可。
英文:
try using:
go env -w GO111MODULE=on
and
go clean -modcache
and install again.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论