diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-02-10 11:38:05 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2023-02-10 14:34:44 +0100 |
| commit | 50b2f41ed948a2a47420d8edc9abca2d477eccfb (patch) | |
| tree | adcef18a7dd0188e32dbf8ef4dad9d5b72f15dde /pkg/subsystem/entity | |
| parent | 0241baba08ba2fd732e46a9634434154d58092e3 (diff) | |
pkg/subsystem: detect loops on the go
This lets us reduce the amount of code in parents.go.
Diffstat (limited to 'pkg/subsystem/entity')
| -rw-r--r-- | pkg/subsystem/entity/entities.go | 3 |
1 files changed, 3 insertions, 0 deletions
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) } |
