An implementation of a finite state machine in Go