mirror of
https://github.com/weaveworks/scope.git
synced 2026-05-26 19:15:55 +00:00
Refactor: streamline Node.WithParents()
Make it take parameters just like all the callers have, instead of making them create a different structure. It is now only used in tests.
This commit is contained in:
@@ -18,13 +18,13 @@ func Prune(nodes report.Nodes) report.Nodes {
|
||||
// necessary for rendering nodes and edges stripped away. Specifically, that
|
||||
// means cutting out parts of the Node.
|
||||
func PruneNode(node report.Node) report.Node {
|
||||
prunedChildren := report.MakeNodeSet()
|
||||
prunedChildren := []report.Node{}
|
||||
node.Children.ForEach(func(child report.Node) {
|
||||
prunedChildren = prunedChildren.Add(PruneNode(child))
|
||||
prunedChildren = append(prunedChildren, PruneNode(child))
|
||||
})
|
||||
return report.MakeNode(
|
||||
node.ID).
|
||||
WithTopology(node.Topology).
|
||||
WithAdjacent(node.Adjacency...).
|
||||
WithChildren(prunedChildren)
|
||||
WithChildren(prunedChildren...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user