Transform your Go structs into tiny state machines.
In Go you quite often need to make your struct thread-safe (basically serialize all the calls to any of its methods) and also allow only particular sequences of calls, e.g. when Close
is called, no other method can be called ever again since it does not make sense to call it. And this is exactly what go-statemachine is handling for your.
No mutexes are being used, just channels. It might not be as fast as mutexes, but it's nice and robust.
I am still developing this, so things may and will change if I find it more appropriate for my use cases.
Check ExampleStateMachine
in statemachine_test.go
to see an example.
We are writing Go, so GoDoc, what were you expecting?
MIT