Golang

go mod 国内镜像

2020-3-15 1177字 9,661

镜像源

  1. 阿里云Go Module
  2. Goproxy 中国

步骤

开启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 (解释为什么需要依赖)
版权声明:Shire 发表于 2020-3-15
转载请注明: go mod 国内镜像 | Shire

评论

该文章已经关闭评论