mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
ensure result adjacencies start empty
Any existing list would be mutated by result(), which is bad. Note that all the existing newJoinResults() call sites pass in nodes with no adjacencies, so this is purely a safety measure.
This commit is contained in:
+2
-1
@@ -169,6 +169,7 @@ type joinResults struct {
|
||||
func newJoinResults(inputNodes report.Nodes) joinResults {
|
||||
nodes := make(report.Nodes, len(inputNodes))
|
||||
for id, n := range inputNodes {
|
||||
n.Adjacency = nil // result() assumes all nodes start with no adjacencies
|
||||
nodes[id] = n
|
||||
}
|
||||
return joinResults{nodes: nodes, mapped: map[string]string{}}
|
||||
@@ -206,7 +207,7 @@ func (ret *joinResults) addChildAndChildren(m report.Node, id string, create fun
|
||||
|
||||
// Add a copy of n straight into the results
|
||||
func (ret *joinResults) passThrough(n report.Node) {
|
||||
n.Adjacency = nil // result() assumes all nodes start with blank lists
|
||||
n.Adjacency = nil // result() assumes all nodes start with no adjacencies
|
||||
ret.nodes[n.ID] = n
|
||||
ret.mapped[n.ID] = n.ID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user