From 5e92b610a5f8832e6a389b1acb01fd0cc866780e Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Sun, 9 Jun 2019 02:17:11 -0400 Subject: test config init using sync.Once --- svc/init_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'svc') diff --git a/svc/init_test.go b/svc/init_test.go index 009b4e0..9c99a3b 100644 --- a/svc/init_test.go +++ b/svc/init_test.go @@ -6,6 +6,7 @@ import ( "log" "os" "strings" + "sync" "time" "github.com/fsnotify/fsnotify" @@ -15,13 +16,14 @@ import ( var testport = fmt.Sprintf(":%v", confObj.Port) var hasInit = false +var initTestOnce sync.Once + func initTestConf() { - if !hasInit { + initTestOnce.Do(func() { testConfig() tmpls = testTemplates() logToNull() - hasInit = true - } + }) } func logToNull() { -- cgit 1.4.1-2-gfad0