英文:
"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 get
by setting the GOPROXY to https://<artifactory-service-url>/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="https://username:api key@my.artifactory.server/artifactory/api/go/go"
After that try the go get
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论