镜像源
阿里云Go Module:http://mirrors.aliyun.com/goproxy/?tdsourcetag=s_pctim_aiomsg
Goproxy 中国:https://goproxy.cn/
步骤
开启GO111MODULE
// linux export GO111MODULE=on // win cmd set GO111MODULE=on // win powershell $env:GO111MODULE="on"
走小飞机代理
// win powershell $env:http_proxy = $env:https_proxy = "http://127.0.0.1:1080"
goproxy.cn代理
// linux export GOPROXY=https://goproxy.cn // win cmd set GOPROXY="https://goproxy.cn" // win powershell $env:GOPROXY="https://goproxy.cn"
脚本
download download modules to local cache (下载依赖的module到本地cache)) edit edit go.mod from tools or scripts (编辑go.mod文件) graph print module requirement graph (打印模块依赖图)) init initialize new module in current directory (再当前文件夹下初始化一个新的module, 创建go.mod文件)) tidy add missing and remove unused modules (增加丢失的module,去掉未用的module) vendor make vendored copy of dependencies (将依赖复制到vendor下) verify verify dependencies have expected content (校验依赖) why explain why packages or modules are needed (解释为什么需要依赖)
文章参考:go mod 国内镜像