Epsilon is a pure Go WebAssembly runtime with zero dependencies.
- Fully supports WebAssembly 2.0 Specification
- Runs on any architecture supported by Go (amd64, arm64, etc.) without requiring CGo
- Allows embedding WebAssembly modules in Go applications
- Includes an interactive REPL for testing and debugging
go get github.com/ziggy42/epsilonLoad and run a WebAssembly module directly from a byte slice:
package main
import (
"fmt"
"os"
"github.com/ziggy42/epsilon/epsilon"
)
func main() {
// 1. Read the WASM file
wasmBytes, _ := os.ReadFile("add.wasm")
// 2. Instantiate the module
instance, _ := epsilon.NewRuntime().InstantiateModuleFromBytes(wasmBytes)
// 3. Invoke an exported function
result, _ := instance.Invoke("add", int32(5), int32(37))
fmt.Println(result[0]) // Output: 42
}Extend your WebAssembly modules with custom Go functions and more using
ImportBuilder:
// Create imports before instantiation
imports := epsilon.NewImportBuilder().
AddHostFunc("env", "log", func(args ...any) []any {
fmt.Printf("[WASM Log]: %v\n", args[0])
return nil
}).
Build()
// Instantiate with imports
instance, _ := epsilon.NewRuntime().
InstantiateModuleWithImports(wasmFile, imports)Epsilon includes a REPL for interactively testing and debugging modules.
# Run the REPL
go run ./cmd/epsilon| Category | Command | Description |
|---|---|---|
| Loading | LOAD <path|url> |
Load a module from a file or URL |
| Running | INVOKE <func> [args...] |
Call an exported function |
| State | GET <global> |
Read a global variable |
| Debug | MEM <offset> <len> |
Inspect linear memory |
| System | LIST |
List loaded modules and their exports |
Example Session:
$ go run ./cmd/epsilon
>> LOAD https://github.com/mdn/webassembly-examples/raw/refs/heads/main/understanding-text-format/add.wasm
'default' instantiated.
>> INVOKE add 10 32
42
# Run unit tests
go test ./epsilon/...
# Run spec tests (requires git submodule)
go test ./internal/spec_tests/...
# Run benchmarks
go test -bench . ./internal/benchmarksSee CONTRIBUTING.md for details.
Apache 2.0; see LICENSE for details.
This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.