From 6037d5c33e9b98360f61a4fe4f09659d0e3e6160 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 May 2024 23:21:59 +0200 Subject: fix: duplicate error logging on config parse error --- searchix.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/searchix.go b/searchix.go index ba33e3f..c2cd19d 100644 --- a/searchix.go +++ b/searchix.go @@ -62,7 +62,9 @@ func main() { cfg, err := config.GetConfig(*configFile) if err != nil { - log.Panicf("error parsing configuration file: %v", err) + // only use log functions after the config file has been read successfully + fmt.Fprintf(os.Stderr, "error parsing configuration file: %v", err) + os.Exit(1) } slog.SetLogLoggerLevel(cfg.LogLevel) if cfg.Web.Environment == "production" { -- cgit 1.4.1