Closed EstebanOlmedo closed 10 months ago
If neither of the two cases are fullfiled then that argument is ignored.
Would it make sense to panic? Today it's not possible to pass an invalid call to InOrder
. It would be nice if I'd be notified right away if I mess up InOrder
, otherwise this will be very hard to debug.
Alternatively, what about a type-safe(r) way of doing this: Having InOrder
accept an interface { Call() *Call }
?
Tested in quic-go in https://github.com/quic-go/quic-go/pull/4057. Seems to work. I also tested that it panic if I pass things other than gomock calls to InOrder
.
🚢 it!
This breaks InOrder()
function calls that pass a []*gomock.Call
slice 😞. It is therefore making it very hard for us to upgrade to a later version of this lib. Would it be sensible to fix or provide an alternative function with the previous method definition (and maybe using the new method internally instead)?
I can see it was previously proposed using an interface that implements a particular method instead. That would also be sensible. Perhaps this route could be revisited.
This modifies
InOrder
to receive variadicany
instead of*Call
, allowing users to use this function with type-safe generated Calls.This implementation uses a type assertion to check if the provided arguments are
*Call
s or reflection to get the*Call
when the arguments wrap one (generated code). If neither of the two cases are fullfiled thenInOrder
panics.Fix #70.