简体   繁体   English

不区分大小写的导入冲突:“ github.com/sirupsen/logrus”和“ github.com/Sirupsen/logrus”

[英]case-insensitive import collision: “github.com/sirupsen/logrus” and “github.com/Sirupsen/logrus”

I'm working with ory-am / hydra and it makes me bug in the Golang library gopkg.in/gorethink/gorethink.v3, the error is as follows: 我正在使用ory-am / hydra,这使我在Golang库gopkg.in/gorethink/gorethink.v3中的错误,错误如下:

../../../gopkg.in/gorethink/gorethink.v3/cluster.go:10:2: case-insensitive import collision: "github.com/sirupsen/logrus" and "github.com/Sirupsen/ logrus "

this after adding go app.go 添加go app.go之后

If you have any suggestions with which you can guide me to solve this incident 如果您有任何建议可以指导我解决此事件

That package went through a very painful, and regretful, rename some time back. 这个程序包经历了非常痛苦和遗憾的重命名。 It was previously Sirupsen/logrus , and was renamed to sirupsen/logrus . 它以前是Sirupsen/logrus ,并更名为sirupsen/logrus The latter is erroneously considered more idiomatic by some, but Go handles mixed case imports with no problem, so the rename was unnecessary, and the author regrets it . 有些人错误地认为后者是惯用语,但是Go可以毫无问题地处理混合大小写的导入,因此重命名是不必要的,因此作者对此感到遗憾 But renaming back would just add to the confusion, so the decision was made to stick with the unnecessary lowercase version. 但是重命名只会增加混乱,因此决定使用不必要的小写版本。

But that's all in the past. 但这仅是过去。 At this point, the lowercase version is the only working one . 此时,小写版本是唯一可用的版本。

The behavior you have observed is usually the result of importing two (or more) packages which depend on the logrus package, one depending on the older name, the other depending on the newer name. 您观察到的行为通常是由于导入两个(或多个)程序包而导致的,这些程序包取决于logrus程序包,一个取决于较旧的名称,另一个取决于较新的名称。 Therefore, if you have a dependency that still has the upper-case version as a dependency, that library needs to be updated. 因此,如果您的依赖项仍具有大写版本作为依赖项,则需要更新该库。

From the project readme : 项目自述文件中

Case-sensitivity 区分大小写

The organization's name was changed to lower-case--and this will not be changed back. 该组织的名称已更改为小写-不会更改回该名称。 If you are getting import conflicts due to case sensitivity, please use the lower-case import: github.com/sirupsen/logrus. 如果由于大小写敏感而导致导入冲突,请使用小写导入:github.com/sirupsen/logrus。

Alternately, you could vendor an old version of the library with the capitalized import name and update all of your imports to use that version. 或者,您可以提供带有大写导入名称的旧版本库,并更新所有导入以使用该版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM