gommon
gommon copied to clipboard
[feature] go mod dependency tree
@hebingchang can you put more detail and tools you have tried .w.
- https://github.com/ewohltman/graphdot generates graph that is too large to open
Actually you can use golist with template https://dave.cheney.net/2014/09/14/go-list-your-swiss-army-knife
go list -f '{{ join .Deps "\n"}}' .
- https://github.com/loov/goda seems ok, but the output does not cover all dependencies.
https://pkg.go.dev/golang.org/x/tools/go/packages?tab=doc and https://github.com/golang/example/tree/master/gotypes could be useful
https://golang.org/cmd/go/#hdr-Explain_why_packages_or_modules_are_needed
Also you can use the command go mod why -m github.com/foo/boar
and it will prints the import order
$ go mod why -m github.com/pingcap/tipb
# github.com/pingcap/tipb
github.com/at15/gegecece/impl/gce4-go/parser/pingcap
github.com/pingcap/parser
github.com/pingcap/parser/model
github.com/pingcap/tipb/go-tipb