What do I do if compilation by using go build takes a long time?

Updated at:

If go build compilation takes a long time or is stuttering, you can use a proxy to accelerate compilation. Setting the GOPROXY environment variable routes module downloads through a faster proxy and resolves the issue.

Set GOPROXY for the current session

Export the variable before building:

export GOPROXY=https://goproxy.cn

Then retry go build.