1

GO ENV 的一些参数

 1 year ago
source link: https://studygolang.com/articles/31964?fr=sidebar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

GO ENV 的一些参数

Hello · 2020-12-05 15:32:36 · 1905 次点击 · 预计阅读时间 1 分钟 · 大约8小时之前 开始浏览    
这是一个创建于 2020-12-05 15:32:36 的文章,其中的信息可能已经有所发展或是发生改变。

在家写代码发现公司的代码down不下来,原因是go get获取代码时,公司里的代码也去go proxy里去获取,这当然获取不到啦。

GOPROXY

go 代理的地址,go get会通过这里获取代码,默认值proxy.golang.org在中国不能访问。所以一般设为国内可用的地址:

GONOPROXY

这里用于配置不走goproxy的代码地址,公司内部代码在proxy里肯定是获取不到的。所以可以这么设置
export GONOPROXY="*.xxxx.com(公司代码地址)"

GOSUMDB

go 用于检验module正确性的服务器地址。GOPROXY为proxy.golang.org时,默认值为sum.golang.org。

GONOSUMDB

同理,公司内部的代码在SUMDB也是无法校验的。所以可以在这里配置
export GONOSUMDB="*.xxx.com(公司代码地址)"

参考自:https://zhuanlan.zhihu.com/p/...

有疑问加站长微信联系(非本文作者)

280

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK