From 50b2f41ed948a2a47420d8edc9abca2d477eccfb Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 10 Feb 2023 11:38:05 +0100 Subject: pkg/subsystem: detect loops on the go This lets us reduce the amount of code in parents.go. --- pkg/subsystem/entity/entities.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg/subsystem/entity') diff --git a/pkg/subsystem/entity/entities.go b/pkg/subsystem/entity/entities.go index 9d1d8e5a5..e2b29a7f3 100644 --- a/pkg/subsystem/entity/entities.go +++ b/pkg/subsystem/entity/entities.go @@ -21,6 +21,9 @@ func (subsystem *Subsystem) ReachableParents() map[*Subsystem]struct{} { return } for _, p := range node.Parents { + if p == subsystem { + panic("loop in the parents relation") + } ret[p] = struct{}{} dfs(p) } -- cgit mrf-deployment