Golang | Set go get domestic mirror, faster

Goproxy China official website: https://goproxy.cn/
GitHub: https://github.com/goproxy/goproxy.cn

usage

Go 1.13 and above (recommended)

Open your terminal and execute

$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct

carry out.

macOS or Linux

Open your terminal and execute

$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn

or

$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile

carry out.

Windows

Open your PowerShell and execute

C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"

or

  1. Open "Start" and search for "env"
  2. Select "Edit System Environment Variables"
  3. Click the "Environment Variables..." button
  4. Under the section "User Variables of <your username>" (the upper part)
  5. Click the "New..." button
  6. Select the "Variable Name" input box and enter "GO111MODULE"
  7. Select the "variable value" input box and enter "on"
  8. Click the "OK" button
  9. Click the "New..." button
  10. Select the "Variable Name" input box and enter "GOPROXY"
  11. Select the "variable value" input box and enter "https://goproxy.cn"
  12. Click the "OK" button

carry out.

Guess you like

Origin blog.csdn.net/y1534414425/article/details/107632750