To speed up our dependencies updating for golang, or prepare some patterns for our special libraries, we probably consider to use a proxy to speed it up.

There are a lot of solutions to play the role as the go proxy server. For example, I am using

To configuration the go proxy, we may required to prepare a environment variable.

export GOPROXY=http://your-proxy-server:port,direct

This environment variable could be configured in various kind of locations. For example, we may define it in $HOME/.bash_profile, every time we are using bash, the environment variable could be configured.

However, to avoid polluting the global environment, we may also define it in some special files.

If you are using macOS, we may configure it in $HOME/Library/Application Support/go/env

GOPROXY=https://goproxy.io,direct

It may not found in the output of printenv, but would got applied in go building system.


The above 2 proxies are only work for public repositories. I had prepared some code, making some authorization, and allow repos able to visit private repo. It did highly reduce the work to divide the projects.

Categories: Code

Yu

Ideals are like the stars: we never reach them, but like the mariners of the sea, we chart our course by them.

Leave a Reply

Your email address will not be published. Required fields are marked *