【Go】vs code安装 install/update tools 遇到zip: not a valid zip file

在 vs code 安装 go 工具包 gopls 或 impl时遇到报错

Installing golang.org/x/tools/gopls@latest FAILED
{
 "code": 1,
 "killed": false,
 "signal": null,
 "cmd": "C:\\Program Files (x86)\\Go\\bin\\go.exe install -v golang.org/x/tools/gopls@latest",
 "stdout": "",
 "stderr": "go: downloading golang.org/x/tools/gopls v0.14.2\ngo: golang.org/x/tools/gopls@latest: zip: not a valid zip file\n"
}
Installing github.com/josharian/impl@v1.1.0 FAILED
{
 "code": 1,
 "killed": false,
 "signal": null,
 "cmd": "C:\\Program Files (x86)\\Go\\bin\\go.exe install -v github.com/josharian/impl@v1.1.0",
 "stdout": "",
 "stderr": "go: downloading golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375\nC:\\code\\go\\pkg\\mod\\github.com\\josharian\\impl@v1.1.0\\impl.go:20:2: zip: not a valid zip file\n"
}
gopls: failed to install gopls(golang.org/x/tools/gopls@latest): Error: Command failed: C:\Program Files (x86)\Go\bin\go.exe install -v golang.org/x/tools/gopls@latest
go: downloading golang.org/x/tools/gopls v0.14.2
go: golang.org/x/tools/gopls@latest: zip: not a valid zip file
 
impl: failed to install impl(github.com/josharian/impl@v1.1.0): Error: Command failed: C:\Program Files (x86)\Go\bin\go.exe install -v github.com/josharian/impl@v1.1.0
go: downloading golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375
C:\code\go\pkg\mod\github.com\josharian\impl@v1.1.0\impl.go:20:2: zip: not a valid zip file

尝试了一些方法都没有生效,包括使用 go clean -modcache命令。

最后通过切换代理源

go env -w GOPROXY=https://goproxy.cn,direct

从阿里代理源切换为 goproxy.cn,direct
再使用 go clean -modcache 命令
最后安装成功

在这里插入图片描述

相关推荐

  1. python安装cx_Oracle 遇到的问题

    2023-12-17 04:02:02       34 阅读
  2. RabbitMQ安装使用遇到的问题

    2023-12-17 04:02:02       27 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-17 04:02:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-17 04:02:02       106 阅读
  3. 在Django里面运行非项目文件

    2023-12-17 04:02:02       87 阅读
  4. Python语言-面向对象

    2023-12-17 04:02:02       96 阅读

热门阅读

  1. 西电微机原理实验三

    2023-12-17 04:02:02       56 阅读
  2. 算法基础十三

    2023-12-17 04:02:02       52 阅读
  3. Linux的双网口(内网+外网)的IP报文转发

    2023-12-17 04:02:02       51 阅读
  4. 23. 如何设计一个前端项目

    2023-12-17 04:02:02       64 阅读
  5. vue3 引入Element Plus 组件库

    2023-12-17 04:02:02       64 阅读
  6. 序列化与反序列化

    2023-12-17 04:02:02       48 阅读
  7. k8s service 内部dns 地址介绍,互相依赖Pod启动介绍

    2023-12-17 04:02:02       60 阅读
  8. 企业与员工

    2023-12-17 04:02:02       58 阅读
  9. (第29天)Oracle 数据泵传输表空间

    2023-12-17 04:02:02       56 阅读