Skip to content

Examples

The repository’s examples directory contains complete source programs with multi-target configurations. Run these commands from a checkout:

Terminal window
go run ./cmd/goalchemy run -target python ./examples/calc
cd examples/bank
go run ../../cmd/goalchemy build

The first command uses the local compiler directly. The second compiles every target listed in the bank example’s goalchemy.yaml.

Example What to study
calc An integer expression parser and evaluator.
bank Typed errors, interfaces, and deferred audit logging.
wordfreq Word counting, maps, sorting, and string operations.
life Conway’s Game of Life on a toroidal board.
jwt Signing and verifying HS256 JSON Web Tokens.
fetch Fetching a CSV over HTTPS and summarizing it.
pipeline Workers, channels, select, and per-job deadlines.

The pipeline example requires the cooperative gate:

Terminal window
go run ./cmd/goalchemy run -gate cooperative -target python ./examples/pipeline

HTTP and crypto examples may need native libraries or target packages. Read the generated output’s README.md and the relevant target guide before running them.