From 07269ce70bcf1d530c5954b9e60fd7b076646182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Fern=C3=A1ndez=20Campo?= Date: Sun, 19 Jan 2020 17:39:42 +0100 Subject: [PATCH 1/2] Fixed panic on bad runtime flags. An FSM is not generated if you use a matching regex. Signed-off-by: Joaquin Fernandez Campo --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 5ff8f21..e8ed549 100644 --- a/main.go +++ b/main.go @@ -229,6 +229,9 @@ func init() { } func dumpFSM(mapper *mapper.MetricMapper, dumpFilename string, logger log.Logger) error { + if mapper.FSM == nil { + return fmt.Errorf("FSM is not available. Posible due to the presence of regex patterns") + } f, err := os.Create(dumpFilename) if err != nil { return err From d81bdf2d3af109f1f4087f67db58fa8e4a8a4702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Fern=C3=A1ndez=20Campo?= Date: Mon, 20 Jan 2020 11:37:30 +0100 Subject: [PATCH 2/2] Update main.go Co-Authored-By: Matthias Rampke Signed-off-by: Joaquin Fernandez Campo --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index e8ed549..cd0c26b 100644 --- a/main.go +++ b/main.go @@ -230,7 +230,7 @@ func init() { func dumpFSM(mapper *mapper.MetricMapper, dumpFilename string, logger log.Logger) error { if mapper.FSM == nil { - return fmt.Errorf("FSM is not available. Posible due to the presence of regex patterns") + return fmt.Errorf("no FSM available to be dumped, possibly because the mapping contains regex patterns") } f, err := os.Create(dumpFilename) if err != nil {