by goproxyio

goproxyio / goproxy

A global proxy for Go modules.

4.4K Stars 281 Forks Last release: about 2 months ago (v2.0.5) MIT License 93 Commits 8 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


CircleCI Go Report Card GoDoc

A global proxy for go modules. see:


It invokes the local go command to answer requests.
The default cacheDir is GOPATH, you can set it up by yourself according to the situation.


git clone
cd goproxy


Proxy mode

./bin/goproxy -listen= -cacheDir=/tmp/test

If you run go get -v pkg in the proxy machine, should set a new GOPATH which is different from the old GOPATH, or mayebe deadlock. See the file test/

Router mode

Use the -proxy flag switch to "Router mode", which implements route filter to routing private module or public module .

                      +----------------------------------> private repo
                  +---+---+           +----------+
go get  +-------> |goproxy| +-------> || +--->
                  +-------+           +----------+
                 router mode           proxy mode

In Router mode, use the -exclude flag set pattern , direct to the repo which match the module path, pattern are matched to the full path specified, not only to the host component.

./bin/goproxy -listen= -cacheDir=/tmp/test -proxy -exclude "*,"

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

Docker Compose

docker-compose up


  1. set
    export GOPROXY=http://localhost
    to enable your goproxy.
  2. set
    export GOPROXY=direct
    to disable it.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.