A global proxy for go modules

First, you will need to enable the Go Modules feature and configure Go to use the proxy.
bash:

export GOPROXY=https://goproxy.io

Or
powershell:

$env:GOPROXY = "https://goproxy.io"

Now, when you build and run your applications, go will fetch dependencies via goproxy.io.

Note: This proxy can't fetch your private repos of course.

Private proxy

Started

./goproxy -listen=0.0.0.0:80 -cacheDir=/data

Use docker image

docker run -d -p80:8081 goproxy/goproxy

Use the -v flag to persisting the proxy module data (change cacheDir to your own dir):

docker run -d -p80:8081 -v cacheDir:/go goproxy/goproxy
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容