如何在代理后面使用Golang的go mod依赖管理? [关闭]

I am trying to set up a project with a gonum dependency and ran into the problem that we have a corporate proxy that blocks many destinations in the internet.

github.com is available over https. gonum.org is not.

The gonum repository is hosted on github. Gonum.org forwards to it in some way, as the repo that is checked out in gonum.org/v1/gonum is just a github clone. Using the go mod tooling by default will fetch all code, which fails since the github urls are aliased to gonum.org which the proxy will block.

Is there a way to download gonum via github and use symlinks/copying around to still be able to use it?

It is possible with go modules. Once you downloaded the gonum sources on your computer, you can tell go to use your local copy instead of the remote one using the replace instruction in your go.mod

Syntax is

module example.com/me/hello

require (
  example.com/me/goodbye v0.0.0
)

replace example.com/me/goodbye => ../goodbye

https://github.com/golang/go/wiki/Modules#can-i-work-entirely-outside-of-vcs-on-my-local-filesystem

It is also possible to setup a proxy outside of your corporate network if the solution given above is not adapted to your team: https://github.com/golang/go/wiki/Modules#are-there-always-on-module-repositories-and-enterprise-proxies