From 9d29a61861ca0b058144abeb31fc9108b4793624 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 1 May 2015 15:39:01 +0200 Subject: [PATCH] debug: init debug logger before init() methods run --- debug/debug.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/debug/debug.go b/debug/debug.go index aab6d9853..55a47198c 100644 --- a/debug/debug.go +++ b/debug/debug.go @@ -20,12 +20,18 @@ var opts struct { m sync.Mutex } -func init() { +// make sure that all the initialization happens before the init() functions +// are called, cf https://golang.org/ref/spec#Package_initialization +var _ = initDebug() + +func initDebug() bool { initDebugLogger() initDebugTags() initDebugBreaks() fmt.Fprintf(os.Stderr, "debug enabled\n") + + return true } func initDebugLogger() {