通过Athens搭建go私服
生活随笔
收集整理的這篇文章主要介紹了
通过Athens搭建go私服
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
go1.11以后就可以使用GOPROXY代理下載包依賴了
使用athens可以很快的使用代理
兩種方法
(需go1.11以上)
一、直接使用 athens 網(wǎng)站的代理
配置環(huán)境變量
export GOPROXY="https://athens.azurefd.net"ps: 記得source
二、安裝 athens
設(shè)置GO111MODULE變量
linux:
export GO111MODULE=onwindows:
$env:GO111MODULE = "on"設(shè)置 http、https 代理 (畢竟被墻)
export {http_proxy,https_proxy}=http://127.0.0.1:1087 (一般是1080端口,我的是1087)然后用git把項目clone下來
$ git clone https://github.com/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代理的地址來獲取到依賴了。
參考鏈接:https://www.dazhuanlan.com/jumble9/topics/1020457
總結(jié)
以上是生活随笔為你收集整理的通过Athens搭建go私服的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用athens部署企业内部Gitlab
- 下一篇: Dockerfile指令详解:ONBUI