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/[email protected]/go/packages/external.go:15:2: golang.org/x/[email protected]: 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
.
Found a workaround:
I updated the
GOPROXY
environment variable:It started working after that.
Maybe some network issue within my company proxy was causing this in the first place.
Note: Add the statement to your respective shell profile to make this change permanent.