It would be nicer if go mod why gave all the paths to a package or module, not just the shortest path. This would help answer common questions like "what would it take to remove dependency X?".
I can get that information indirectly via go list -deps -json or go mod graph, processing or plotting the output somehow. Or even using third party tools like https://github.com/loov/goda.
Still, I think this rather simple change would make go mod why significantly more useful for simple use cases, without having to go to something much more involved like a graph or a dependency query language.
The text was updated successfully, but these errors were encountered:
The syntax for this is a bit tricky. With a single path, the output can just be the nodes (packages) along the path. With the complete import subgraph, we would presumably need some way to show the edges too.
But I guess go mod graph does already have a format for edges...
An extra thought - the package variant of go mod graph should accept the usual build flags and arguments. Using go-pkg-graph as a placeholder for the sake of the examples:
# the entire graph for all packages here
# only the sub-graph with the current main package at its root
# same as the above, but with different build params
GOOS=windows go-pkg-graph -tags=purego