Skip to content
siutsinPublic

About

From Go to Factorio: What Games Can Teach Us About Compilers

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

gofactos

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.

Download slides.

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.

Demo: Recursive Fibonacci

Fibonacci running in Factorio

Requirements

  • Go 1.26 or later
  • Factorio 2.0 with Space Age's Quality mod enabled

Quick Start

From the repository root, generate a blueprint string:

go run . blueprint --set n=8 demo/fibonacci.go

Copy 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.go

The specification defines the supported Go subset.

Development

Install the pinned tools with Mise:

mise install
mise exec -- make test

See the testing guide for race and Factorio E2E tests.

Documentation

See the documentation index for project goals, supported features, design, and development guides.

AI Usage

This project is absolutely just for fun and educational purposes and might contain AI slop. Use at your own risk ¯\_(ツ)_/¯.

About

From Go to Factorio: What Games Can Teach Us About Compilers

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages