@@ -33,7 +33,7 @@ var graphCmd = &cobra.Command{
3333 For example to generate a svg image use:
3434 twopi -Tsvg -o dag.svg graph.dot` ,
3535 RunE : func (cmd * cobra.Command , args []string ) error {
36- depGraph , deps , mainModule := getDepInfo ()
36+ overview := getDepInfo ()
3737 // strict ensures that there is only one edge between two vertices
3838 // overlap = false ensures the vertices don't overlap
3939 fileContents := "strict digraph {\n graph [overlap=false];\n "
@@ -42,10 +42,10 @@ var graphCmd = &cobra.Command{
4242 if dep != "" {
4343 var chains []Chain
4444 var temp Chain
45- getAllChains (mainModule , depGraph , temp , & chains )
45+ getAllChains (overview . MainModuleName , overview . Graph , temp , & chains )
4646 fileContents += getFileContentsForSingleDep (chains , dep )
4747 } else {
48- fileContents += getFileContentsForAllDeps (deps , depGraph , mainModule )
48+ fileContents += getFileContentsForAllDeps (overview )
4949 }
5050 fileContents += "}"
5151 fileContentsByte := []byte (fileContents )
@@ -102,18 +102,18 @@ func getFileContentsForSingleDep(chains []Chain, dep string) string {
102102
103103// get the contents of the .dot file for the graph
104104// of all dependencies (when -d is not set)
105- func getFileContentsForAllDeps (deps [] string , depGraph map [ string ][] string , mainModule string ) string {
105+ func getFileContentsForAllDeps (overview * DependencyOverview ) string {
106106
107107 // color the main module as yellow
108- data := colorMainNode (mainModule )
109- for _ , dep := range deps {
110- _ , ok := depGraph [dep ]
108+ data := colorMainNode (overview . MainModuleName )
109+ for _ , dep := range overview . DepList {
110+ _ , ok := overview . Graph [dep ]
111111 if ! ok {
112112 continue
113113 }
114114 // main module can never be a neighbour
115- for _ , neighbour := range depGraph [dep ] {
116- if dep == mainModule {
115+ for _ , neighbour := range overview . Graph [dep ] {
116+ if dep == overview . MainModuleName {
117117 // for the main module use a colored node
118118 data += fmt .Sprintf ("\" MainNode\" -> \" %s\" \n " , neighbour )
119119 } else {
0 commit comments