Closed
Description
There was a discussion about gomock hang on panic because it's ctrl.Finish()
was called inside t.Cleanup
instead of defer
(golang/mock#428). It helped me to realize t.Cleanup
won't be called in case of panic
, as I (and probably others too) was expected.
At a glance it looks feasible to change testing package to add few internal defer
to ensure t.Cleanup
will be called on panic
/t.FailNow
. And as current documentation doesn't mention is this will happens or not we can consider this change compatible.
In case this proposal will be rejected I think it's worth to update the doc and make explicit that t.Cleanup won't be called on panic, because this limits it usability a lot and probably contradict user's expectations.