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"},
})
f.Dot("diag_name")
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" ];
}