Conversation
|
I didn't test this yet, but I am mostly OK with these changes, just a few comments:
We usually try to avoid adding too much dependencies to dh-make-golang, especially to make it easier to backport. I didn't check these specific dependencies, they might be alright (stable and already in Debian), but if it is easy to write without adding dependencies it would be appreciated.
Does this mean the repeated dependencies (with a number in parenthesis) are not displayed any more? I did add this on purpose, see the reasoning here: #241
Seems nice, I originally decided to simply put an hyperlink to reduce the clutter, but this might also look good.
These also look nice |
ottok
left a comment
There was a problem hiding this comment.
Overall looks good! We should however not merge this until the new dependency is packaged, or alternatively move that commit into a separate PR.
This improves readability, and makes it easier for a future commit to change how the output is handled. For example, the lines could be written immediately to stdout instead of saved in a slice to reduce memory usage for complex modules, or a 3rd party package could be used to produce the terminal color codes.
b698162 to
20731f9
Compare
Repeating the subtree has a few problems:
* It adds a lot of unneeded noise to the output.
* It makes it impossible to render dependency cycles, which Go
permits (e.g., golang.org/x/net <-> golang.org/x/crypto).
* It over-counts how much a dependency is needed. For example, with
the following dependencies:
a -> b
a -> c
a -> d
b -> c
c -> d
it used to print something like:
a
b
c
d
c (2)
d (2)
d (3)
and now it prints:
a
b
c
d
c (2)
d (2)
Stated precisely, the number is now the number of edges in the
dependency graph that point to the dependency, not the number of
paths from the root node to the dependency.
Automatically disable escape codes when stdout is not a terminal for the sake of tools that might parse this utility's output. Add a new command-line option to allow the user to force color on or off.
20731f9 to
f817d89
Compare
I removed that dependency. I will open a separate PR to use github.com/fatih/color (packaged as golang-github-fatih-color-dev) once fatih/color#255 is merged and the Debian package is updated to include it.
The number is still there, but it now counts something different: Instead of showing the number of paths from the root module (the root node of the dependency graph) to the dependency it now counts the number of edges pointing to the dependency (the number of times the dependency appears as a requirement in a
I changed the URL to the DFSG team dashboard. Thank you both for reviewing! |
I understand the reasoning, but there is an issue with this approach, it can miss some dependencies. Consider for example this estimate command: Note the "buf.build" dependencies especially that get cut out in your branch. This is because of Module graph pruning, which will remove a dependency from the graph if is is not directly used by the code that requires it. I know that this is an "estimate" command anyway, but I for one would prefer that it show more redundant lines rather than make the work appear simpler than what it really is. |
That's due to a bug in graph construction done by I would fix that bug (and others I've noticed) before merging this PR, but there's a chicken-and-egg problem: if I fix the graph construction bugs, dependency cycles become common (e.g., (BTW, I recently wrote gomoddepgraph to address the graph construction bugs in |
So, do you think it does not come from module graph pruning? I assumed it was because of this that multiple occurrences of the same modules could have a different list of dependencies.
What do you think about keeping only the refactoring and color related parts in this PR, and do another one that completely replaces the dependency graph part, and fixes the output accordingly?
I did read most of this package's documentation, it seems really nice! Do you plan on merging it inside dh-make-golang or keep it as a separate module? |


The significant changes in this PR:
There are also some related code cleanups.
(please do not squash the commits in this PR)