我有一个带有 gomod 的 Go 程序,当我运行 go build 时。
我收到以下错误:
go: github.com/sirupsen/[email protected] used for two different module paths (github.com/Sirupsen/logrus and github.com/sirupsen/logrus)
我的 go mod 看起来像
require (
github.com/Sirupsen/logrus v1.4.2 // indirect
github.com/sirupsen/logrus v1.4.2
…
)
我添加了以下内容,但没有帮助,知道吗?
replace (
github.com/Sirupsen/logrus v1.4.2 => github.com/sirupsen/logrus v1.4.2
)
在我的项目代码中,我使用仅小写的import
路径github.com/sirupsen/logrus
最佳答案
尝试删除//indirect
行,然后运行
go mod tidy # prune any extraneous requirements + other stuff
go clean # remove object files and cached files
go get -v -u all # update everything related to the dependencies
go build # finger crossed!
关于go - 运行 go build 时出错。带有日志存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58500310/