go-common/app/interface/main/space/service/service_test.go
2019-04-22 18:49:16 +08:00

25 lines
401 B
Go

package service
import (
"flag"
"path/filepath"
"time"
"go-common/app/interface/main/space/conf"
"go-common/library/log"
)
var svf *Service
func WithService(f func(s *Service)) func() {
return func() {
dir, _ := filepath.Abs("../cmd/space-test.toml")
flag.Set("conf", dir)
conf.Init()
log.Init(conf.Conf.Log)
svf = New(conf.Conf)
time.Sleep(200 * time.Millisecond)
f(svf)
}
}