go-common/app/admin/main/esports/service/service_test.go

25 lines
372 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package service
import (
"flag"
"path/filepath"
"time"
"go-common/app/admin/main/esports/conf"
)
var svf *Service
func WithService(f func(s *Service)) func() {
return func() {
dir, _ := filepath.Abs("../cmd/esports-admin-test.toml")
flag.Set("conf", dir)
conf.Init()
if svf == nil {
svf = New(conf.Conf)
}
time.Sleep(2 * time.Second)
f(svf)
}
}