Go resource is the fastest solution for wall

Original link: https://juejin.im/post/5cd945946fb9a032060c47a3, added that the latest version of the go 1.13 in default is to use the go module, can be directly set up a proxy;
Note: If you can not upgrade to 1.11 above, to download the package can be manually GOPATH corresponding directory, then input to the corresponding local uri Import;

Recent study golang , because of cultural self-confidence, Go language pack a lot of the country can not be obtained, writing this tutorial hope to help you solve the resource problem fastest wall, do not waste time on this meaningless things.

surroundings

  1. $ go version # go version go1.12 darwin/amd64
  2. Copy the code
  • Golang upgrade to 1.11 (recommended 1.12 , after 1.11, go to the official introduction of the go module dependency management to solve the problem. This is a quick fix is the core of the wall.

Set GO111MODULE and GOPROXY

  • The mac system, open end
    1. $ vim .bash_profile
    Plus
    1. export GO111MODULE = on (1.13 can not, the default is on)
    2. export GOPROXY=https://goproxy.io
    Save and exit;
  • Execution source ~/.bash_profile; just make modifications to take effect immediately;
  • Open a new terminal , do not enter on a terminal interface go env; see if GOPROXY="https://goproxy.io"the configuration was successful;
  • Free download bag.

Related

Guess you like

Origin www.cnblogs.com/silentdoer/p/11774957.html