Getting: go: error loading module requirements
Solution 1
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/[email protected]
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.
Solution 2
It seems to be an issue with the GOPROXY set. What's the output of go env
?
Related videos on Youtube
rchughtai
Updated on June 23, 2022Comments
-
rchughtai 6 months
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
[email protected] ~/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/[email protected]: unknown revision v1.2.0 go: github.com/davecgh/[email protected]: unknown revision v1.1.1 go: github.com/pkg/[email protected]: unknown revision v0.8.0 go: github.com/stretchr/[email protected]: unknown revision v1.2.2 go: github.com/pmezard/[email protected]: unknown revision v1.0.0 go: error loading module requirements