私人回购 - go 1.13 - `go mod ..` 失败:ping “sum.golang.org/lookup"..验证包.. 410没了 [英] private repo - go 1.13 - `go mod ..` failed: ping "sum.golang.org/lookup" .. verifying package .. 410 gone

查看:12
本文介绍了私人回购 - go 1.13 - `go mod ..` 失败:ping “sum.golang.org/lookup"..验证包.. 410没了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 golang 1.13 .

I am using golang 1.13 .

我有一个依赖于私有 gitlab 项目的项目.

I have a project that depends on a private gitlab project.

我有相同的 ssh 密钥.

I have the ssh keys for the same.

当我尝试检索新创建的模块的依赖项时,我收到以下错误:

When I try to retrieve the dependencies for a newly created module, I am getting the following error:

$ go version
go version go1.13 linux/amd64

$ go mod why
go: downloading gitlab.com/mycompany/myproject v0.0.145
verifying gitlab.com/mycompany/myproject@v0.0.145: gitlab.com/mycompany/myproject@v0.0.145: reading https://sum.golang.org/lookup/gitlab.com/mycompany/myproject@v0.0.145: 410 Gone

我不知道它为什么要尝试 ping sum.golang.org/lookup,因为它是一个私人 gitlab 项目.

I have no idea why it is trying to ping sum.golang.org/lookup since it is a private gitlab project.

我的 ~/.gitconfig 包含以下内容(基于我在 google 中查找类似错误)

My ~/.gitconfig contains the following (based on my looking up in google search for similar errors)

# Enforce SSH
[url "ssh://git@github.com/"]
  insteadOf = https://github.com/
[url "ssh://git@gitlab.com/"]
        insteadOf = https://gitlab.com/
[url "ssh://git@bitbucket.org/"]
  insteadOf = https://bitbucket.org/
[url "git@gitlab.com:"]
        insteadOf = https://gitlab.com/

错误仍然存​​在.

我希望包从我的私人 gitlab 项目存储库下载到当前项目.

I would expect the package to be downloaded from my private gitlab project repository to the current project.

我需要在我的私人 gitlab 项目存储库中做些什么来让它为去获取"做好准备吗?

Is there anything I need to do in my private gitlab project repository to make it ready for 'go get' ?

私有 gitlab 项目存储库也已经包含该项目的 go.sum 和 go.mod.

The private gitlab project repository already contains the go.sum and go.mod for the project as well.

我错过了什么?

edit: 1) 私有仓库名称和公司名称不包含星号或任何其他特殊字符.只有字母,甚至没有数字字符.

edit: 1) The private repo name and the company name contains no asterisks or any other special characters. only alphabets and not even numeric characters.

推荐答案

查了自己的问题,

设置 GOPRIVATE 变量似乎有帮助.

Setting the GOPRIVATE variable seems to help.

GOPRIVATE=gitlab.com/mycompany/*  go mod why

"新的 GOPRIVATE 环境变量指示不公开可用的模块路径.它用作较低级别的 GONOPROXY 和 GONOSUMDB 变量的默认值,它们提供了对通过代理获取哪些模块并使用校验和数据库进行验证的更细粒度的控制." 来自 https://golang.org/doc/go1.13

" The new GOPRIVATE environment variable indicates module paths that are not publicly available. It serves as the default value for the lower-level GONOPROXY and GONOSUMDB variables, which provide finer-grained control over which modules are fetched via proxy and verified using the checksum database. " from https://golang.org/doc/go1.13

Aliter:

设置环境变量 GONOSUMDB 似乎也有效.具体来说,调用以下命令似乎会有所帮助.

Setting the env variable GONOSUMDB also seems to work. Specifically, invoking the following command seems to help.

    GONOSUMDB=gitlab.com/mycompany/* go mod why

上面的 env 变量阻止了对 sum.golang.org/lookup 的 ping 校验和匹配.它还可以防止将私有存储库的名称泄漏到公共校验和数据库.[ 来源 - https://docs.gomods.io/configuration/sumdb/ ]

The above env variable prevents the ping to sum.golang.org/lookup for a checksum match. It also prevents leaking the names of private repos to a public checksum db. [ Source - https://docs.gomods.io/configuration/sumdb/ ]

还有 - 在这里

  * GONOSUMDB=prefix1,prefix2,prefix3 sets a list of module path prefixes, again possibly containing globs, that should not be looked up using the database.

来源:https://go.googlesource.com/提案/+/master/design/25530-sumdb.md

相关问题:

  • https://github.com/golang/go/issues/32291
  • https://github.com/golang/go/issues/33985 ["Go 1.13 has been released, and this issue was filed well after the freeze window. The proposed changes will not happen in 1.13, but don't assume they will necessarily happen in 1.14 either." from issue 33985 above. ]

这篇关于私人回购 - go 1.13 - `go mod ..` 失败:ping “sum.golang.org/lookup"..验证包.. 410没了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆