From d4613f156bfa67a5c82721fe2a30f7f10c736324 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Tue, 4 Dec 2018 14:16:31 +0100 Subject: [PATCH] defer at right place --- main/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/main.go b/main/main.go index f91a9d78b..2981993ba 100644 --- a/main/main.go +++ b/main/main.go @@ -109,7 +109,6 @@ func main() { // Configuration error. Exit with a special value to prevent systemd from restarting. os.Exit(23) } - defer server.Close() if *test { fmt.Println("Configuration OK.") @@ -120,6 +119,7 @@ func main() { fmt.Println("Failed to start", err) os.Exit(-1) } + defer server.Close() // Explicitly triggering GC to remove garbage from config loading. runtime.GC()