From 3c19889459d6f87e4c1529faf05196917afcae4a Mon Sep 17 00:00:00 2001 From: Ricard Lado Date: Fri, 21 Jun 2024 21:31:36 +0200 Subject: [PATCH] Close configuration file once parsed --- src/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.go b/src/main.go index 6fcb809..a3b9877 100644 --- a/src/main.go +++ b/src/main.go @@ -354,7 +354,6 @@ func main() { if err != nil { log.Fatalf("Error opening config file: %s", err) } - defer file.Close() cfg := config{} err = json.NewDecoder(file).Decode(&cfg) @@ -362,6 +361,8 @@ func main() { log.Fatalf("Error decoding config file: %s", err) } + file.Close() + // Enforce minimum interval of 60 seconds if cfg.Global.Interval < 60 { if *verbose {