gommon icon indicating copy to clipboard operation
gommon copied to clipboard

[feature] go mod dependency tree

Open hebingchang opened this issue 4 years ago • 6 comments

hebingchang avatar Apr 04 '20 04:04 hebingchang

@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

at15 avatar Apr 04 '20 04:04 at15

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"}}' .

at15 avatar Apr 04 '20 05:04 at15

  • https://github.com/loov/goda seems ok, but the output does not cover all dependencies.

hebingchang avatar Apr 04 '20 05:04 hebingchang

https://pkg.go.dev/golang.org/x/tools/go/packages?tab=doc and https://github.com/golang/example/tree/master/gotypes could be useful

at15 avatar Apr 30 '20 15:04 at15

https://golang.org/cmd/go/#hdr-Explain_why_packages_or_modules_are_needed

at15 avatar May 20 '20 12:05 at15

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

at15 avatar Aug 06 '20 01:08 at15