如何识别go.sum
中存在但go.mod
中不存在的模块的导入路径?我想知道go.mod
中的哪个模块正在导入go.sum
中列出的模块,以及它们之间的整个链。
我正在从我的一个模块和我自己的依赖项中删除一个不推荐使用的模块logrus
,并希望确保我自己的代码中没有一个仍然使用它,以及哪些其他代码确实使用它
Go模块同时具有go.mod
和go.sum
文件。在go.sum
文件中,会出现未出现在go.mod
文件中的模块github.com/sirupsen/logrus
。
当我通过删除go.sum
并运行go test -v ./...
来重新创建go.sum
文件时,go.sum
文件将使用logrus
重新创建。
go.mod
中没有直接或间接提及,例如:
github.com/sirupsen/logrus v1.6.0 // indirect
go mod why
返回以下内容:
$ go mod why github.com/sirupsen/logrus
# github.com/sirupsen/logrus
(main module does not need package github.com/sirupsen/logrus)
go mod why -m
返回以下内容:
$ go mod why -m github.com/sirupsen/logrus
# github.com/sirupsen/logrus
(main module does not need module github.com/sirupsen/logrus)
如何了解go.mod
中的哪个模块正在导入一个模块logrus
,该模块在go.sum
中列出,但在go.mod
中没有列出?
这是模块:
- 模块:https://github.com/grokify/goauth
go.mod
go.sum
go mod why github.com/sirupsen/logrus
# or
go mod graph | grep logrus