VSCode: gopls: failed to install [read "https:/proxy.golang.org/@v/v0.1.0.zip": stream error: stream ID 9; NO_ERROR; received from peer]

huangapple go评论89阅读模式
英文:

VSCode: gopls: failed to install [read "https:/proxy.golang.org/@v/v0.1.0.zip": stream error: stream ID 9; NO_ERROR; received from peer]

问题

在使用VSCode打开我的Go项目或使用Go: install/update tools命令时,我遇到了以下错误:

1个工具安装失败。

gopls: 无法安装gopls(golang.org/x/tools/gopls@latest): 错误: 命令执行失败: /usr/local/bin/go install -v golang.org/x/tools/gopls@latest
go: 正在下载 golang.org/x/sys v0.1.0
../../pkg/mod/golang.org/x/tools@v0.2.1-0.20221101170700-b5bc717366b2/go/packages/external.go:15:2: golang.org/x/sys@v0.1.0: 读取"https:/proxy.golang.org/@v/v0.1.0.zip"时出错: 流错误: 流ID 9; NO_ERROR; 从对等方接收到

GOPATH已正确设置(其他工具已成功安装)。

版本信息:

  • VSCode: 1.73.1
  • Golang: 1.19.3
英文:

While opening my Go project in VSCode or using the Go: install/update tools command I am getting the following error:

1 tools failed to install.

gopls: failed to install gopls(golang.org/x/tools/gopls@latest): Error: Command failed: /usr/local/bin/go install -v golang.org/x/tools/gopls@latest
go: downloading golang.org/x/sys v0.1.0
../../pkg/mod/golang.org/x/tools@v0.2.1-0.20221101170700-b5bc717366b2/go/packages/external.go:15:2: golang.org/x/sys@v0.1.0: read "https:/proxy.golang.org/@v/v0.1.0.zip": stream error: stream ID 9; NO_ERROR; received from peer

GOPATH is set properly (other tools were installed successfully).

Versions:

  • VSCode: 1.73.1
  • Golang: 1.19.3.

答案1

得分: 2

找到了一个解决方法:

我只是简单地更新了GOPROXY环境变量:

export GOPROXY="direct"

之后它开始工作了。

也许是我公司代理服务器内部的网络问题导致了一开始的错误。

英文:

Found a workaround:

I simply updated the GOPROXY environment variable:

export GOPROXY="direct"

It started working after that.

Maybe some network issue within my company proxy was causing this in the first place.

答案2

得分: 0

太棒了!

在运行时,我遇到了以下错误:

go install -v golang.org/x/tools/gopls@latest

go: 正在下载 golang.org/x/tools v0.8.0
go: 正在下载 golang.org/x/tools/gopls v0.11.0
go: golang.org/x/tools/gopls@latest: golang.org/x/tools/gopls@v0.11.0: 获取 "https://proxy.golang.org/golang.org/x/tools/gopls/@v/v0.11.0.zip" 时出错: read tcp [2806:101e:7:d0fa:50f3:9273:e1c7:b8ce]:53301->[2607:f8b0:4007:809::2011]:443: wsarecv: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败,或者已建立的连接失败。

在 Windows Powershell 上执行了以下操作:

Set-Item Env:GOPROXY "direct"

然后,问题解决了!

谢谢!

英文:

Genius!

I was facing the following error while running:

go install -v golang.org/x/tools/gopls@latest

go: downloading golang.org/x/tools v0.8.0
go: downloading golang.org/x/tools/gopls v0.11.0
go: golang.org/x/tools/gopls@latest: golang.org/x/tools/gopls@v0.11.0: Get "https://proxy.golang.org/golang.org/x/tools/gopls/@v/v0.11.0.zip": read tcp [2806:101e:7:d0fa:50f3:9273:e1c7:b8ce]:53301->[2607:f8b0:4007:809::2011]:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.go install -v golang.org/x/tools/gopls@latest
go: downloading golang.org/x/tools v0.8.0
go: downloading golang.org/x/tools/gopls v0.11.0
go: golang.org/x/tools/gopls@latest: golang.org/x/tools/gopls@v0.11.0: Get "https://proxy.golang.org/golang.org/x/tools/gopls/@v/v0.11.0.zip": read tcp [2806:101e:7:d0fa:50f3:9273:e1c7:b8ce]:53301->[2607:f8b0:4007:809::2011]:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Did the following on Windows Powershell

Set-Item Env:GOPROXY "direct"

And boom, solved!

Thank you!

huangapple
  • 本文由 发表于 2022年11月10日 15:48:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/74385660.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定