General
- Always check context after a blocking call, before checking
err. Expired state ctx isreturn // expired. - Prefer traced mutations
Ev*(e...)ife *am.Eventin the scope. - The default ctx in a handler is the handler's state ctx, unless it's a
Multistate. - Always list states from imported schemas (usually
./states/ss_*.go). - Always mimic the example schema (order, naming).
- Every schema has to inherit from
*am.StatesBase - Almost every schema has to inherit from
*ss.BasicStates, unless specified otherwise or an edge-case. - Schema failes are called
ss_{name}.go
- Every schema has to inherit from
- Prefer
am.NewCommonconstructor overam.Newand always add env-based debugging withSetArgsMapper(LogArgs)and groups (if any). - Always verify created files using
go buildand the LSP. - Use single-state methods (
*1suffix) for single-state calls, egAdd1(state), instead ofAdd(am.S{state})
Details
Source: pancsta/asyncmachine-go — distributed by TomeVault.