2

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.
Saikat
  • 14,222
  • 20
  • 104
  • 125

2 Answers2

2

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.

Saikat
  • 14,222
  • 20
  • 104
  • 125
0

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!

Edward Casanova
  • 726
  • 7
  • 19