Closed gregory-m closed 6 years ago
The -pgraph
flag that @rsc mentioned in https://github.com/golang/go/issues/26581#issuecomment-407942311 should address this, I think.
Since go.mod
is versioned it could be fine to record the origin of the indirect dependencies directly in the comments
// indirect from ... (and ... and ...)
For builds involving a lot of packages that could get pretty ungainly, and it would potentially add a lot of unnecessary diffs as the set of packages changes over time.
Hm. The current behaviour looks quite broken to me, I can't explain the output of this. Is it because the vast majority of the packages don't have their own concrete mod files yet?
It's confusing that it shows all of these as hanoverd imports - in reality hanoverd only imports a couple of packages, including docker, which results in quite a large tree.
But then, gopkg.in/yaml.v2@v2.2.1 gets its own line presumably because it is the only one with a mod file?
Is it because the vast majority of the packages don't have their own concrete mod files yet?
I think so, yes. Was github.com/sensiblecodeio/hanoverd
the main module in that invocation?
Yes.
Change https://golang.org/cl/128359 mentions this issue: cmd/go: add go mod why
@rsc: I'm concerned that the above CL might not actually fix the issue presented.
I understand there are two things going on, (1) you are addressing, and (2) not obviously?
That there is the module+package graph, which go mod why
is intended to explore.
If I understand the outputs and my experience above correctly, -graph
is not reporting edges in the module graph.
It's perhaps not explicitly clear, but in the outputs of -graph
presented by the original issue and in my comment, -graph
is attributing a huge swathe of dependencies to github.com/gregory-m/mod-test
(OP) and github.com/sensiblecodeio/hanoverd
(mine), when actually they are indirect dependencies. The only other edges shown appear to be for repositories which have physical .mod
files.
I'd expect this is intended to be shown in -graph
, but understand it is not currently?
What version of Go are you using (
go version
)?go version go1.11beta2 darwin/amd64
What did you do?
What did you expect to see?
Reason why
gopherjs
or any other indirect dependency added to mod file.What did you see instead?
No simple way to understand why indirect dependencies added to mod file.