aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-02-16 15:53:29 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-17 10:01:32 +0100
commit3e7039f40cdc73052372e83bef288c26ed5256d8 (patch)
tree057a1f44bf77afab8081e528ec515ec473944461 /pkg/subsystem
parent0f6b41b602586fe3e0417a031bc96d7182f776a3 (diff)
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().
Diffstat (limited to 'pkg/subsystem')
-rw-r--r--pkg/subsystem/service.go3
1 files changed, 3 insertions, 0 deletions
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))