Skip to content

Commit

Permalink
clean up invoke method
Browse files Browse the repository at this point in the history
  • Loading branch information
miladrahimi committed Oct 30, 2019
1 parent 870286d commit da7bf08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
)

// invoke will call the given function and return its returned value.
func invoke(function interface{}) interface{} {
arguments := arguments(function)
return reflect.ValueOf(function).Call(arguments)[0].Interface()
// It only works for functions that return a single value.
func invoke(f interface{}) interface{} {
return reflect.ValueOf(f).Call(arguments(f))[0].Interface()
}

// binding is a struct that keeps a binding resolver and instance (for singleton bindings).
Expand Down

0 comments on commit da7bf08

Please sign in to comment.