If a developer runs go test ./... from within the Athens project and they have a GOPROXY environment set, our tests will actually use that variable because our tests run the go command internally.
We have 4 options:
I might just take this haha.
@Mark-Jung thank you! I think the best thing to do is maybe temporarily set GOPROXY=off in TestMain for the tests that use the GoGetFetcher internally
But would love to get more opinions on this issue from you and others as well :)
I vote for reproducibility as much as possible, which IMO would be setting GOPROXY=https://proxy.golang.org.
On top of that, we would be testing Athens against another implementation of the download protocol, which helps us make sure that we work in the larger ecosystem.
@marwan-at-work
Not sure I understand why go "knows" about GOPROXY env var.
Aren't we creating a separate env here? https://github.com/gomods/athens/blob/a4cf4eb991f375724426d7b466c0705386ad7da3/pkg/module/go_get_fetcher.go#L139
Why is GOPROXY leaked?
@marpio very good point, I totally forgot about that :)
Looking back at the slack channel where the issue was originally reported:

I just realized that I misdiagnosed the issue, it's not that our unit tests were seeing the GOPROXY environment variables and using it, it's that @Mark-Jung had set the GOPROXY variable and that his local cache did not have the Athens dependencies yet, and it tried to download them before running the actual unit tests...Hah!
I just locally ran GOPROXY=<fake-domain> go test ./... and everything worked normally
Thanks again for bringing it up!
Most helpful comment
I might just take this haha.