dag: Fix graph printing type mismatch
Dependencies were being sorted, but their types were not, causing incorrect printing.
This commit is contained in:
parent
ddffb47492
commit
a4c96e5619
11
dag/graph.go
11
dag/graph.go
|
@ -202,16 +202,17 @@ func (g *Graph) StringWithNodeTypes() string {
|
||||||
|
|
||||||
// Alphabetize dependencies
|
// Alphabetize dependencies
|
||||||
deps := make([]string, 0, targets.Len())
|
deps := make([]string, 0, targets.Len())
|
||||||
targetNodes := make([]Vertex, 0, targets.Len())
|
targetNodes := make(map[string]Vertex)
|
||||||
for _, target := range targets.List() {
|
for _, target := range targets.List() {
|
||||||
deps = append(deps, VertexName(target))
|
dep := VertexName(target)
|
||||||
targetNodes = append(targetNodes, target)
|
deps = append(deps, dep)
|
||||||
|
targetNodes[dep] = target
|
||||||
}
|
}
|
||||||
sort.Strings(deps)
|
sort.Strings(deps)
|
||||||
|
|
||||||
// Write dependencies
|
// Write dependencies
|
||||||
for i, d := range deps {
|
for _, d := range deps {
|
||||||
buf.WriteString(fmt.Sprintf(" %s - %T\n", d, targetNodes[i]))
|
buf.WriteString(fmt.Sprintf(" %s - %T\n", d, targetNodes[d]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue