使用Golang的远程仓库时出现”400 Bad Request”错误。

huangapple go评论81阅读模式
英文:

"400 Bad Request" when using remote repository of Golang

问题

我已经设置了一个名为"golang-remote"的Golang远程仓库,它指向https://proxy.golang.org

当我尝试使用go get命令,并将GOPROXY设置为https://<artifactory-service-url>/artifactory/api/go/golang-remote时,我收到了400 Bad Request的错误。

我对设置Golang包的缓存代理不太熟悉,我的远程仓库配置有问题吗?或者使用方式有误?

提前感谢!

英文:

I have set up a Golang remote repository named "golang-remote" which points to https://proxy.golang.org.

When I tried to use it with go getby setting the GOPROXY to https://&lt;artifactory-service-url&gt;/artifactory/api/go/golang-remote, I got the error 400 Bad Request.

I'm not quite familiar with setting up a caching proxy for Golang packages, are there any wrong configurations to my remote repository or wrong usage?

Thanks in advance!

答案1

得分: 3

Artifactory仅支持从虚拟Go存储库解析Go软件包。要解析其他本地或远程Go存储库中的Go软件包,您需要将它们聚合到一个虚拟Go存储库中。

创建一个名为"go"的虚拟存储库示例,并将远程存储库"golang-remote"包含在其中,以将其与虚拟存储库关联起来。完成后设置GOPROXY环境变量:

export GOPROXY="https://username:api key@my.artifactory.server/artifactory/api/go/go"

然后尝试使用go get命令。

英文:

Artifactory only supports the resolution of Go packages from virtual Go repositories. To resolve Go from other local or remote Go repositories, you need to aggregate them in a virtual Go repository.

Create a virtual repo example: "go" and include the remote repository "golang-remote" to associate it with the virtual repo. Once done set the GOPROXY

export GOPROXY=&quot;https://username:api key@my.artifactory.server/artifactory/api/go/go&quot;

After that try the go get.

huangapple
  • 本文由 发表于 2022年1月12日 15:32:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/70677789.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定