refactor: lift some code out of inner loop

This commit is contained in:
Matthias Radestock
2017-12-27 13:54:30 +00:00
parent 7c5e9339bb
commit 4206760021
+4 -4
View File
@@ -39,6 +39,10 @@ func Parents(r report.Report, n report.Node) []Parent {
if !ok {
continue
}
apiTopologyID, ok := primaryAPITopology[topologyID]
if !ok {
continue
}
parents, _ := n.Parents.Lookup(topologyID)
for _, id := range parents {
if topologyID == n.Topology && id == n.ID {
@@ -48,10 +52,6 @@ func Parents(r report.Report, n report.Node) []Parent {
if !ok {
parentNode = report.MakeNode(id).WithTopology(topologyID)
}
apiTopologyID, ok := primaryAPITopology[topologyID]
if !ok {
continue
}
if summary, ok := MakeBasicNodeSummary(r, parentNode); ok {
result = append(result, Parent{
ID: summary.ID,