di.go 297 B

12345678910111213141516171819
  1. package dep
  2. import "kpt-event/util/di"
  3. func DI(opts ...di.HubOption) *di.Hub {
  4. var hubOpts []di.HubOption
  5. if len(opts) != 0 {
  6. hubOpts = append(opts, Global())
  7. } else {
  8. hubOpts = append(hubOpts, Global())
  9. }
  10. hub, err := di.New(hubOpts...)
  11. if err != nil {
  12. panic(err)
  13. }
  14. return hub
  15. }