From f6d8bce2d523a925f4ff316f5035b926b196499d Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Fri, 25 Oct 2024 18:45:21 +0200 Subject: [PATCH] Log error if config file cannot be closed --- idicon.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/idicon.go b/idicon.go index 42a8157..b104c2b 100644 --- a/idicon.go +++ b/idicon.go @@ -109,7 +109,12 @@ func configure(configFile string) { log.Printf("Invalid configuration file '%s' - ignore it.\n", configFile) } - defer file.Close() + defer func(file *os.File) { + err := file.Close() + if err != nil { + log.Printf("Cannot close config file") + } + }(file) config = *c }