【问题标题】:go build from different repositories with different proxy settings从具有不同代理设置的不同存储库构建
【发布时间】:2020-03-05 09:19:08
【问题描述】:

我使用 go-modules 来构建我的 go-project。该项目使用来自 github.com 和 git.companyname.com 的 deps。 但是 github.com 需要代理设置。调用“go build”命令后,它会从本地存储库下载 deps,并在需要代理时停在 github.com 存储库。这就是为什么我仍然手动下载所有依赖项的原因。有没有办法配置 go 编译器为不同的 git 存储库使用不同的代理设置?

【问题讨论】:

  • 这可能有助于go help module-private

标签: go build proxy


【解决方案1】:

使用以下命令:

$ git config --global url."<proxy-url>".insteadOf "https://github.com/"

【讨论】:

  • 运行“go build”后能否从github.com(需要代理)和git.somecompany.com(无代理)获取所有依赖?谢谢
  • 上述逗号表示,每当 go 模块尝试从 https://github.com/ 获取时,它将被转发到给定的 &lt;proxy-url&gt;。因此,它不会转发对其他 URL 的调用。
猜你喜欢
  • 2014-02-28
  • 2017-12-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-19
  • 2017-04-09
  • 1970-01-01
  • 2017-11-26
相关资源
最近更新 更多