首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >错误扫描github.com/golang/protobuf/proto/testdata:无法找到包“。

错误扫描github.com/golang/protobuf/proto/testdata:无法找到包“。
EN

Stack Overflow用户
提问于 2018-05-27 07:53:31
回答 1查看 772关注 0票数 1

在我的项目上运行glide install时,我会得到以下错误:

代码语言:javascript
运行
复制
[ERROR] Error scanning github.com/golang/protobuf/proto/testdata: cannot find package "." in:
    /Users/bevernie/.glide/cache/src/https-github.com-golang-protobuf/proto/testdata
[ERROR] Failed to retrieve a list of dependencies: Error resolving imports

在检查protobuf的源代码时,我实际上可以看到没有这样的包。但是,我不直接使用protobuf,因此错误必须来自我使用的依赖项之一。

在我的项目上运行glide tree时,只有一个github.com/golang/protobuf/proto/testdata实例

代码语言:javascript
运行
复制
|-- github.com/golang/protobuf/proto   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
|   |-- github.com/golang/protobuf/proto/test_proto   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto/test_proto)
|   |   |-- (Recursion) github.com/golang/protobuf/proto   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
|   |-- github.com/golang/protobuf/ptypes/any   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/ptypes/any)
|   |   |-- (Recursion) github.com/golang/protobuf/proto   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
    github.com/golang/protobuf/proto/testdata   (glide get github.com/golang/protobuf/proto/testdata)
|-- github.com/golang/protobuf/ptypes/any   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/ptypes/any)
|   |-- github.com/golang/protobuf/proto   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
|   |   |-- github.com/golang/protobuf/proto/test_proto   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto/test_proto)
|   |   |   |-- (Recursion) github.com/golang/protobuf/proto   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/proto)
|   |   |-- (Recursion) github.com/golang/protobuf/ptypes/any   (/Users/bevernie/Programmation/work/src/github.com/golang/protobuf/ptypes/any)

这并不能真正帮助我找出问题的根源。

对于如何解决这些问题,你有什么建议吗?

直到一两周前,我的项目才进行了很好的编译(我使用Docker在生产中进行部署,因此glide install每次都运行,在此之前从未失败过,最近我也没有添加任何新的依赖项)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-27 08:33:00

在你自己的PR (995)之前,有滑翔号968

看起来它是由存储库的结构变化引起的,即一个子包正在被移动,或者被完全删除。

)提出的解决办法

如果已经更新的包在您自己的控制之下,那么我发现使用一些较新的Go特性(比如类型别名)来减轻重构带来的痛苦会更容易。 所以,不要仅仅移动一个包,而是移动它,然后在旧包中的新位置创建别名,这样您的旧代码仍然可以工作。 然后,慢慢地把东西移开。基本上,只需将其标记为已不再推荐的内容,但要确保它们在一段时间内仍然可用,直到您移植完新代码。 如果包不在您的控制范围内,则始终可以将您想要的版本手动克隆到您的供应商文件夹中,并在代码中进行更新。 一旦你完成了,幻灯片应该让你再次更新。 如果它要复杂得多,有时甚至更容易恢复到使用go get,直到您完成更新包,并依赖您的$GOPATH内容。 这远非理想,但至少有一些方法可以绕过它。 同时,我也在dep上对此提出了一个问题。 我认为他们正在研究一种禁用这种检查的方法,如果您只想让工具信任您作为开发人员。

因此,您可以使用戈德普来检查是否存在相同的问题,甚至使用边缘vgo

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50550127

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档