Skip to content

Commit

Permalink
[i-love-flamingo#7]: failing on usage of struct receiver in 'Inject' …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
Tristan Baumbusch committed Oct 28, 2022
1 parent 93c63cc commit 58efddd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dingo.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,10 @@ func (injector *Injector) requestInjection(object interface{}, circularTrace []c

i++

if ctype.Kind() != reflect.Ptr && current.MethodByName("Inject").IsValid() {
return fmt.Errorf("usage of 'Inject' method with struct receiver is not allowed: %s", current.String())
}

switch ctype.Kind() {
// dereference pointer
case reflect.Ptr:
Expand Down

0 comments on commit 58efddd

Please sign in to comment.