The 10-minute path from discussion #3 (design B: go:generate, checked-in generated Go, --check CI mode). This directory IS the sample — an ordinary Go module that added two Hybrid files:
go.mod ordinary module + the two hybrid.program lines
app.go hand-written Go, unchanged
calc.hy the Hybrid-checked file (ownership-checked concurrent sum)
calc.hy.go GENERATED Go (checked in, reviewable, diffable)
-
Install Hybrid (see the release page's one-command install), then vendor the runtime once:
hyb vendor-runtime .This creates
./hybridrt/(the binding packages +lib/libhyrt.a+ its ownmodule hybrid.programgo.mod). -
Add two lines to your
go.mod:require hybrid.program v0.0.0 replace hybrid.program => ./hybridrt -
Drop
.hyfiles beside your.gofiles, and put ONE generate line in any Go file of the package://go:generate hyb generate . -
Run the ordinary build:
go generate ./... go build ./... && go run . && go test ./...
calc.hy.go is plain Go: read it, diff it, review it. Delete calc.hy and the
project is a plain Go module again — the pitch is literal.
hyb generate --check . && go build ./...
A .hy edited without regenerating fails --check (exit 1) — an untranspiled
file can never silently skip the checker.
The vendored runtime ships lib/libhyrt.a; hyb vendor-runtime . copies the
fresh arch-matched staticlib. A .hy file with import "rust/serde_json"
transpiles to cgo-using Go that builds under the same go build ./....