Skip to content

Commit

Permalink
fix: strict variable name 🍻
Browse files Browse the repository at this point in the history
  • Loading branch information
GGXXLL authored Jan 20, 2022
1 parent 5ebb7c5 commit cb1abd6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions c.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ func Default(opts ...CoreOption) *C {
// container. The semantics of injection follows the same rule of dig.Invoke.
// Note that the module added in this way will not retain any original field
// values, i.e. the module will only contain fields populated by DI container.
func (c *C) AddModule(modules interface{}) {
t := reflect.TypeOf(modules)
func (c *C) AddModule(module interface{}) {
t := reflect.TypeOf(module)
if t.Kind() == reflect.Ptr && dig.IsIn(t.Elem()) {
err := di.IntoPopulator(c.di).Populate(modules)
err := di.IntoPopulator(c.di).Populate(module)
if err != nil {
panic(err)
}
c.Container.AddModule(modules)
c.Container.AddModule(module)
return
}
if dig.IsIn(t) {
Expand All @@ -226,7 +226,7 @@ func (c *C) AddModule(modules interface{}) {
c.Container.AddModule(copy.Elem().Interface())
return
}
c.Container.AddModule(modules)
c.Container.AddModule(module)
}

// Provide adds dependencies provider to the core. Note the dependency provider
Expand Down

0 comments on commit cb1abd6

Please sign in to comment.