Skip to content

Commit

Permalink
some cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
miladrahimi committed Oct 30, 2019
1 parent da7bf08 commit 6682cb3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

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

// binding is a struct that keeps a binding resolver and instance (for singleton bindings).
// binding keeps a binding resolver and instance (for singleton bindings).
type binding struct {
resolver interface{} // resolver function
instance interface{} // instance stored for singleton bindings
Expand All @@ -30,7 +30,7 @@ func (b binding) resolve() interface{} {
// container is the IoC container that will keep all of the bindings.
var container = map[string]binding{}

// bind will map an abstraction to a concrete and set instance if it was a singleton binding.
// bind will map an abstraction to a concrete and set instance if it's a singleton binding.
func bind(resolver interface{}, singleton bool) {
if reflect.TypeOf(resolver).Kind() != reflect.Func {
panic("the resolver must be a function")
Expand Down

0 comments on commit 6682cb3

Please sign in to comment.