From da7bf08fb67d5016ca82910fa11433de85c67474 Mon Sep 17 00:00:00 2001 From: miladrahimi Date: Wed, 30 Oct 2019 13:21:24 +0330 Subject: [PATCH] clean up invoke method --- container.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/container.go b/container.go index b718439..8a551b8 100644 --- a/container.go +++ b/container.go @@ -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).