fsm
fsm copied to clipboard
Should cancelFunc be public?
From the v1.0.0 release, the cancelFunc
is introduced during FSM init with context. However, we had decoupled the callback function. When the unit test of callback may panic since it may cause the cancelFunc
is not assignable.
For example:
create a callback function and do the unit test with a callback function. The input event may not have cancelFunc and caused panic.
P.S: Here is the event caused the panic.
Suggestion:
- We may need to skip the
cancelFunc
if it is nil to give decouple when testing the callback function here. - We may need to public the
cancelFunc
to CancelFunc or a set function to assign thecancelFunc
.
Having the same issue, should cancelFunc
be always non-nil and be a no-op by default?