service_test.go 367 B

12345678910111213141516171819202122232425262728
  1. package history
  2. import (
  3. "flag"
  4. "path/filepath"
  5. "time"
  6. "go-common/app/interface/main/app-interface/conf"
  7. )
  8. var (
  9. s *Service
  10. )
  11. func init() {
  12. dir, _ := filepath.Abs("../cmd/app-interface-test.toml")
  13. flag.Set("conf", dir)
  14. conf.Init()
  15. s = New(conf.Conf)
  16. time.Sleep(time.Second)
  17. }
  18. func WithService(f func(s *Service)) func() {
  19. return func() {
  20. f(s)
  21. }
  22. }