From 562abec7f4ef5bc3abb70bdb09f08db08de20867 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Mon, 15 May 2023 11:50:54 +0000 Subject: [PATCH] feat: fail fast on regexp error --- distro.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/distro.go b/distro.go index 94f02fa..9c0f5ad 100644 --- a/distro.go +++ b/distro.go @@ -51,14 +51,17 @@ type DebianGetDebCmd struct { } func (cmd DebianGetDebCmd) Run() (err error) { + re, err := regexp.Compile(cmd.Regexp) + if err != nil { + log.Fatal().Err(err).Msg("regexp") + } + kernels, err := debian.GetKernels() if err != nil { log.Error().Err(err).Msg("") return } - re := regexp.MustCompile(cmd.Regexp) - var packages []snapshot.Package for _, kernel := range kernels { for _, pkg := range kernel.Packages() {