golang set network proxy

golang set network proxy

1. Check the environment variables of go In cmd, type

go env

2. to set the GOPROXY proxy.

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

3. Set GOPRIVATE to skip private libraries, such as the commonly used Gitlab or Gitee, separated by commas: go env -w GOPRIVATE=*.git

go env -w GOPRIVATE=*.gitlab.com,*.gitee.com

4. If, when running go mod vendor, it prompts Get https://sum.golang.org/lookup/xxxxxx: dial tcp i/o timeout, it is because Go 1.13 set the default GOSUMDB=sum.golang .org, which is walled and used to verify the validity of packages, can be turned off with the following command.

go env -w GOSUMDB=off

5. You can set GOSUMDB="sum.golang.google.cn", this is specifically for the domestic sum verification service.

go env -w GOSUMDB="sum.golang.google.cn"


Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example