Getting: go: error loading module requirements

Viewed 14985

I am trying to run a go script for SLACK bot that downloaded from git. https://github.com/nlopes/slack/blob/master/examples/websocket/websocket.go#L34

I replaced the auth code of my bot in the websocket.go

rchughta@C02WW32YHTD6 ~/g/s/e/websocket> go run websocket.go
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/gorilla/websocket v1.2.0
go: github.com/gorilla/websocket@v1.2.0: unknown revision v1.2.0
go: github.com/davecgh/go-spew@v1.1.1: unknown revision v1.1.1
go: github.com/pkg/errors@v0.8.0: unknown revision v0.8.0
go: github.com/stretchr/testify@v1.2.2: unknown revision v1.2.2
go: github.com/pmezard/go-difflib@v1.0.0: unknown revision v1.0.0
go: error loading module requirements
2 Answers

Make sure you are using the latest Go 1.13.1.

If go mod tidy does not solve the issue, check that a simple go get github.com/gorilla/websocket@v1.2.0 works.

If it does not, it could be, as in this thread, a proxy configuration issue: it depends on your local environment, you might need to set a company proxy server to get anything.


Update August 2020: note that with Go 1.15:

The GOPROXY environment variable now supports skipping proxies that return errors.

Proxy URLs may now be separated with either commas (,) or pipe characters (|).

  • If a proxy URL is followed by a comma, the go command will only try the next proxy in the list after a 404 or 410 HTTP response.
  • If a proxy URL is followed by a pipe character, the go command will try the next proxy in the list after any error.

Note that the default value of GOPROXY remains https://proxy.golang.org,direct, which does not fall back to direct in case of errors.

It seems to be an issue with the GOPROXY set. What's the output of go env?

Related