I've needed to find out this kind of info lots of times in the past.
I wrote a small tool named "showdeps" that includes the capability
to find out why a dependency is present.
You can run "showdeps -why somepackage" to find out why there
is a dependency on somepackage, which prints a line showing
each package involved in the dependency and the packages
that depend on it.
You can also use the "..." wildcard to find out dependencies
on a whole repo; for example "showdeps -why github.com/foo/bar/..."
would print out all dependencies involved in the chain from
the current package to any package below github.com/foo/bar.
With large dependency projects, I find this quite a bit easier than
trying to work out the linkage by inspecting the whole graph.
To get showdeps:
go get github.com/rogpeppe/showdeps
Hope this helps,
rog.
On 30 July 2017 at 05:55, Tong Sun <[email protected]> wrote:
> Is there any tools out there that can show import tree for Go projects?
> I.e., the dependency graph that shows who imports what packages.
>
> During `go build -v` I saw one (3rd party) package that shouldn't be
> included, and am wondering who is introducing that dependency.
> How can I find out? Thx.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.