gofactos is built for my GopherCon 2026 talk, From Go to Factorio: What Games Can Teach Us About Compilers. It turns a supported Go function into a Factorio 2.0 blueprint and can print the function's static single assignment (SSA) form.
gofactos uses the public, source-oriented
golang.org/x/tools/go/ssa. The Go compiler has a separate,
lower-level SSA implementation at
cmd/compile/internal/ssa, but Go's internal package rules
keep it private to the compiler. See the SSA guide for details.
- Go 1.26 or later
- Factorio 2.0 with Space Age's Quality mod enabled
From the repository root, generate a blueprint string:
go run . blueprint --set n=8 demo/fibonacci.goCopy the output into Factorio's Import string dialog. See Clock and reset to run the loop.
Inspect the blueprint JSON or SSA:
go run . blueprint --json --set n=8 demo/fibonacci.go
go run . analyse demo/fibonacci.goThe specification defines the supported Go subset.
Install the pinned tools with Mise:
mise install
mise exec -- make testSee the testing guide for race and Factorio E2E tests.
See the documentation index for project goals, supported features, design, and development guides.
This project is absolutely just for fun and educational purposes and might contain AI slop. Use at your own risk ¯\_(ツ)_/¯.
