学会使用go mod引用依赖包

it2023-06-03  113

先使用module   linux: export GO111MODULE=on windows: set GO111MODULE=on   初始化项目之后会出现一个go.mod和go.sum go mod init <project name>   设置环境变量GOPROXY的值为 https://goproxy.io 或 https://athens.azurefd.net或 https://mirrors.aliyun.com/goproxy/, 至于使用哪个自己PING一下 我一直使用的是aliyun的代理(下载更快) https://mirrors.aliyun.com/goproxy/   linux: export GOPROXY=https://mirrors.aliyun.com/goproxy/ windows: set GOPROXY=https://mirrors.aliyun.com/goproxy/   下载的包会放到/root/go/pkg/mod目录下供项目使用
最新回复(0)