[英]How to identify dependency chain using Go Modules
如何识别存在于go.sum
但不存在于go.mod
中的模块的导入路径? 我想知道 go.mod 中的哪个模块正在导入go.mod
中列出的go.sum
,以及它们之间的整个链。
我正在从我的一个模块和我自己的依赖项中删除一个已弃用的模块logrus
,并希望确保我自己的代码中没有一个仍在使用它,并且其他代码确实使用了它。
Go 模块具有go.mod
和go.sum
文件。 在go.sum
文件中,出现了一个模块github.com/sirupsen/logrus
,它没有出现在go.mod
文件中。
When I recreate the go.sum
file by deleting go.sum
and running go test -v./...
, the go.sum
file is recreated with 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
?
这是模块:
go mod why github.com/sirupsen/logrus
# or
go mod graph | grep logrus
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.