From 3e7039f40cdc73052372e83bef288c26ed5256d8 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 16 Feb 2023 15:53:29 +0100 Subject: pkg/subsystem: panic on empty service creation This might happen if the user forgot to import pkg/subsystem/lists. Make the problem more visible by panicking in ServiceList(). --- pkg/subsystem/service.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg/subsystem') diff --git a/pkg/subsystem/service.go b/pkg/subsystem/service.go index e3dabcfce..b27200c30 100644 --- a/pkg/subsystem/service.go +++ b/pkg/subsystem/service.go @@ -13,6 +13,9 @@ type Service struct { } func MustMakeService(list []*Subsystem) *Service { + if len(list) == 0 { + panic("the subsystem list is empty") + } service, err := MakeService(list) if err != nil { panic(fmt.Sprintf("service creation failed: %s", err)) -- cgit mrf-deployment