From a7b9c373aa6d6314f2dd44b53e4fb1f7861b60d5 Mon Sep 17 00:00:00 2001 From: skurganov Date: Wed, 27 Jul 2016 13:14:40 +0300 Subject: [PATCH] feature: use "Do" return value. Overlap "Return". --- gomock/call.go | 35 ++++++++++++++++++++++------------- gomock/controller.go | 7 ++----- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/gomock/call.go b/gomock/call.go index 1b748da..f1dd317 100644 --- a/gomock/call.go +++ b/gomock/call.go @@ -203,7 +203,7 @@ func (c *Call) dropPrereqs() (preReqs []*Call) { return } -func (c *Call) call(args []interface{}) (rets []interface{}, action func()) { +func (c *Call) call(args []interface{}) (action func() []interface {}) { c.numCalls++ // Actions @@ -218,22 +218,31 @@ func (c *Call) call(args []interface{}) (rets []interface{}, action func()) { doArgs[i] = reflect.Zero(ft.In(i)) } } - action = func() { c.doFunc.Call(doArgs) } + action = func() []interface {} { + result := c.doFunc.Call(doArgs) + rets := make([]interface{}, len(result)) + for i:=0; i