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
|
||||
deps := make([]string, 0, targets.Len())
|
||||
targetNodes := make([]Vertex, 0, targets.Len())
|
||||
targetNodes := make(map[string]Vertex)
|
||||
for _, target := range targets.List() {
|
||||
deps = append(deps, VertexName(target))
|
||||
targetNodes = append(targetNodes, target)
|
||||
dep := VertexName(target)
|
||||
deps = append(deps, dep)
|
||||
targetNodes[dep] = target
|
||||
}
|
||||
sort.Strings(deps)
|
||||
|
||||
// Write dependencies
|
||||
for i, d := range deps {
|
||||
buf.WriteString(fmt.Sprintf(" %s - %T\n", d, targetNodes[i]))
|
||||
for _, d := range deps {
|
||||
buf.WriteString(fmt.Sprintf(" %s - %T\n", d, targetNodes[d]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue