finds.dev← search

// the find

qmuntal/stateless

★ 1,357 · Go · BSD-2-Clause · updated Feb 2026

Go library for creating finite state machines

A Go port of the well-known .NET stateless library for building UML-style hierarchical state machines. Handles the standard FSM constructs — entry/exit actions, guard clauses, parameterized triggers, substates — and is a direct API translation rather than a novel design. Good fit for workflow engines, device state modeling, or anywhere you'd otherwise hand-roll a switch statement that grew too complex.

Hierarchical states with proper substate semantics (IsInState propagates up the hierarchy, entry/exit events don't fire on internal substate transitions). External state storage hooks mean you can wire it directly to an ORM field or any binding layer without fighting the library. DOT graph export is genuinely useful for debugging — state diagrams that are always in sync with code beat any hand-drawn diagram. Thread-safe by default and the API is idiomatic Go: context.Context everywhere, errors returned properly.

Trigger parameters use `...any` with runtime type assertions and will panic on mismatch — this is a Go limitation but it means you don't catch parameter mismatches at compile time. Guard clauses must be mutually exclusive but the library doesn't enforce this statically; you'll get silent wrong behavior if two guards are simultaneously true rather than a clear error. The codebase is a single flat package with no sub-packages, which is fine for its size but the test files sprawl. Last meaningful commit activity suggests the project is in maintenance mode — it works, but don't expect active evolution.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →