summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-06-09 02:17:11 -0400
committerBen Morrison <ben@gbmor.dev>2019-06-09 02:17:11 -0400
commit5e92b610a5f8832e6a389b1acb01fd0cc866780e (patch)
tree0ac688f9e962d7e82c18854f9785c94d8d1c7033
parent21e981bb66c0e7a15fd001844601888098a9333a (diff)
downloadgetwtxt-5e92b610a5f8832e6a389b1acb01fd0cc866780e.tar.gz
test config init using sync.Once
-rw-r--r--svc/init_test.go8
1 files changed, 5 insertions, 3 deletions
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() {