列出模块的依赖关系,而不是包
List dependencies for module, not package
如果我有这个文件:
package main
import "github.com/dinedal/textql/storage"
我可以使用其中之一列出依赖项:
go list -deps
go mod graph
但是,如果我有这个文件:
package main
import "github.com/dinedal/textql"
未列出所有依赖项。例如查看 mod file,
none require
下的软件包现在已列出。最后我尝试了这个
有趣的结果:
PS C:\> go list -deps github.com/dinedal/textql
go: finding module for package github.com/dinedal/textql
module github.com/dinedal/textql@latest found
(v0.0.0-20200608170856-250cf763f52c), but does not contain package
github.com/dinedal/textql
根据评论,我能够获得模块的依赖项列表
像这样:
go mod init deps
go get github.com/dinedal/textql
go list -deps github.com/dinedal/textql/...
此命令也可用于测试,因为它会清除模块缓存:
go clean -modcache
如果我有这个文件:
package main
import "github.com/dinedal/textql/storage"
我可以使用其中之一列出依赖项:
go list -deps
go mod graph
但是,如果我有这个文件:
package main
import "github.com/dinedal/textql"
未列出所有依赖项。例如查看 mod file,
none require
下的软件包现在已列出。最后我尝试了这个
有趣的结果:
PS C:\> go list -deps github.com/dinedal/textql
go: finding module for package github.com/dinedal/textql
module github.com/dinedal/textql@latest found
(v0.0.0-20200608170856-250cf763f52c), but does not contain package
github.com/dinedal/textql
根据评论,我能够获得模块的依赖项列表 像这样:
go mod init deps
go get github.com/dinedal/textql
go list -deps github.com/dinedal/textql/...
此命令也可用于测试,因为它会清除模块缓存:
go clean -modcache