service_test.go 387 B

12345678910111213141516171819202122232425262728
  1. package income
  2. import (
  3. "flag"
  4. "path/filepath"
  5. "time"
  6. "go-common/app/admin/main/growup/conf"
  7. )
  8. var (
  9. s *Service
  10. )
  11. func init() {
  12. dir, _ := filepath.Abs("../../cmd/growup-admin.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. // Reset(func() { CleanCache() })
  21. f(s)
  22. }
  23. }