失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 通过Athens搭建go私服

通过Athens搭建go私服

时间:2020-11-29 16:44:25

相关推荐

通过Athens搭建go私服

go1.11以后就可以使用GOPROXY代理下载包依赖了

使用athens可以很快的使用代理

两种方法

(需go1.11以上)

一、直接使用 athens 网站的代理

配置环境变量

export GOPROXY=""

ps: 记得source

二、安装 athens

设置GO111MODULE变量

linux:

export GO111MODULE=on

windows:

$env:GO111MODULE = "on"

设置 http、https 代理 (毕竟被墙)

export {http_proxy,https_proxy}=http://127.0.0.1:1087 (一般是1080端口,我的是1087)

然后用git把项目clone下来

$ git clone /gomods/athens$ cd athens/cmd/proxy$ go install$ proxy & (后台进程方式启动,也可以使用screen等方式)[1] 27892INFO[0000] Exporter not specified. Traces won't be exportedINFO[0000] Starting application at http://127.0.0.1:3000

然后再配置GOPROXY

export GOPROXY=http://127.0.0.1:3000

配置完成之后使用

go mod download

或者

go get

之后,都会使用GOPROXY代理的地址来获取到依赖了。

参考链接:/jumble9/topics/1020457

如果觉得《通过Athens搭建go私服》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。