diff --git a/gomock/controller.go b/gomock/controller.go index 9d17a2f..528944c 100644 --- a/gomock/controller.go +++ b/gomock/controller.go @@ -19,6 +19,7 @@ import ( "fmt" "reflect" "runtime" + "runtime/debug" "sync" ) @@ -206,7 +207,7 @@ func (ctrl *Controller) Call(receiver any, method string, args ...any) []any { // and this line changes, i.e. this code is wrapped in another anonymous function. // 0 is us, 1 is controller.Call(), 2 is the generated mock, and 3 is the user's test. origin := callerInfo(3) - ctrl.T.Fatalf("Unexpected call to %T.%v(%v) at %s because: %s", receiver, method, args, origin, err) + ctrl.T.Fatalf("Unexpected call to %T.%v(%v) at %s because: %s\n from %s", receiver, method, args, origin, err, debug.Stack()) } // Two things happen here: