Go-Mini is a Go-like scripting engine with a bytecode-first runtime.
- Compile source code to
go-mini-bytecode - Run prepared programs without AST on the main runtime path
- Generate schema-only FFI bindings with
cmd/ffigen
go install gopkg.d7z.net/go-mini/cmd/exec@latest
go install gopkg.d7z.net/go-mini/cmd/ffigen@latestRun a script:
go run ./cmd/exec -run script.goCompile to bytecode:
go run ./cmd/exec -o script.json script.goRun bytecode:
go run ./cmd/exec -bytecode script.jsonGenerate FFI bindings:
go run ./cmd/ffigen -pkg orderlib -out order_ffigen.go interface.goGOCACHE=/tmp/go-build-cache go test ./core/runtime
GOCACHE=/tmp/go-build-cache go test ./core/e2e/...
GOCACHE=/tmp/go-build-cache go test ./...Go-Mini exposes VM-native task primitives plus a task module facade:
spawn(fn, ...args)creates a task and returnsPtr<task.Task>await(task)waits and returns the result, but rethrows task failure/cancel as runtime errorgo f()is Go syntax sugar for fire-and-forget spawntask.NewTaskGroup()creates a task-aware group forPtr<task.Task>task.AddTask/WaitTasks/GroupErr/CancelGroupmanage task collectionstask.Status(task)returnspending|running|succeeded|failed|canceledtask.Err(task)returnsnilfor pending/running/succeeded tasks, andErrorfor failed or canceled taskstask.Cancel(task)requests cancellation through task context- captured closures use task-boundary snapshot semantics: child tasks see a copy of captured VM values, and child writes do not flow back to the parent
- captured host handles and task handles keep shared identity across task boundaries, so child tasks can still call host methods or await/query existing tasks
Lifecycle rules:
- root
mainreturning cancels all unfinished child tasks - shutdown cancellation is best-effort and observed only at VM safe points
- unfinished background tasks are not awaited automatically
gotask failures do not interrupt the parent flow unless explicitly observed viaawaitortask.Err- snapshot capture still rejects VM pointers, modules, runtime-backed interfaces, recursive containers, and other task-unsafe runtime objects
This project is licensed under the MIT License. See LICENSE.