An implementation of a finite state machine in Go
Switch branches/tags
Nothing to show
Clone or download
dpapathanasiou Renamed and changed the example to use the standard testing package, …
…defined as the "statemachine_test" package, which makes it compatible with 'go get' and 'go test'.

Also updated the README with information about how to set $GOPATH correctly.
Latest commit d24ae83 May 4, 2013



This package provides an implementation of a finite state machine in Go (, inspired by David Mertz's article "Charming Python: Using state machines" (


Install the package in your environment:

$ go get

Make sure the GOPATH environment variable is defined correctly and test it:

$ go test
ok	0.014s

To use it within your own code, import "" and instantiate the state machine with an empty map of handler functions, along with the string name of the initial state handler function.


See the statemachine_test.go file included in this package.