status-go/vendor/go.uber.org/dig/internal/dot
RichΛrd 0babdad17b
chore: upgrade go-waku to v0.5 (#3213)
* chore: upgrade go-waku to v0.5
* chore: add println and logs to check what's being stored in the enr, and preemptively delete the multiaddr field (#3219)
* feat: add wakuv2 test (#3218)
2023-02-22 17:58:17 -04:00
..
README.md chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00
graph.go chore: upgrade go-waku to v0.5 (#3213) 2023-02-22 17:58:17 -04:00

README.md

Dot

The dot module generates a DOT file representation of a dependency graph.

Interpreting the graph

The graph should be read from left to right. The leftmost node in the graph (the root node) depends on its dependency tree to the right. An arrow from node_a to node_b in the graph means that node_b is consumed by node_a and that node_b is a parameter of node_a. The rendered graph holds the following kinds of nodes,

Nodes:

  • Constructors [Rectangles]: Takes parameters and produces results.
  • Results [Ovals]: Results inside a constructor are produced by that constructor. Results are consumed directly by other constructors and/or part of a group of results.
  • Groups [Diamonds]: Represent value groups in fx. Multiple results can form a group. Any result linked to a group by an edge are members of that group. A group is a collection of results. Groups can also be parameters of constructors.

Edges:

  • Solid Arrows: An arrow from node_a to node_b means that node_b is a parameter of node_a and that node_a depends on node_b.
  • Dashed Arrows: A dashed arrow from node_a to node_b represents an optional dependency that node_a has on node_b.

Graph Colors:

  • Red: Graph nodes are the root cause failures.
  • Orange: Graph nodes are the transitive failures.

Testing and verifying changes

Unit tests and visualize golden tests are run with

$ make test

You can visualize the effect of your code changes by visualizing generated test graphs as pngs.

In the dig root directory, generate the graph DOT files with respect to your latest code changes.

$ go test -generate

Assuming that you have graphviz installed and are in the testdata directory, generate a png image representation of a graph for viewing.

$ dot -Tpng ${name_of_dot_file_in_testdata}.dot -o ${name_of_dot_file_in_testdata}.png
$ open ${name_of_dot_file_in_testdata}.png

Graph Pruning

If dot.Visualize is used to visualize an error graph, non-failing nodes are pruned out of the graph to make the error graph more readable to the user. Pruning increases readability since successful nodes clutter the graph and do not help the user debug errors.