In easiest cases gomock.InOrder is more than enough to describe an order of calls. But once you spawn a goroutine it becomes a partial one. Consider an scheme where:
Parent thread makes calls calls Ax, spawn goroutines and then do some calls B1, …,Bm:
A1
A2
…
An
spawn goroutines
B1
…
Bm
With such a reference helper you can do just several well-separated gomock.InOrder calls to ensure a proper order:
var anCall *gomock.Call
// order for the main thread
gomock.InOrder(A1, A2, …, gomock.Ref(&anCall, An), B1, …, Bm)
// orders for goroutines
gomock.InOrder(g11.After(anCall), g12, g13, …)
gomock.InOrder(g21.After(anCall), g22, g23, …)
…
Requested feature
A function to make a reference of a call into a call variable:
This func just assigns a call to a call variable.
Why this feature is needed
In easiest cases
gomock.InOrder
is more than enough to describe an order of calls. But once you spawn a goroutine it becomes a partial one. Consider an scheme where:With such a reference helper you can do just several well-separated
gomock.InOrder
calls to ensure a proper order: