FSM - Finite state machine in Go
go get github.com/yandd/fsm

f, err := fsm.NewFSM("inited", []interface{}{"ended"}, fsm.FSMEvents{
{Name: "start", From: "inited", To: "started"},
{Name: "work", From: "started", To: "working"},
{Name: "end", From: []interface{}{"started", "working"}, To: "ended"},
})
digraph diag_name {
rankdir=LR;
node [shape = doublecircle];ended ;
node [shape = circle];
inited -> started [ label = "start" ];
started -> working [ label = "work" ];
started -> ended [ label = "end" ];
working -> ended [ label = "end" ];
}