A fast Go interpreter that supports all Go language features, including generics and generic methods.
- Go 1.25 ~ 1.27
- Go (gc)
- LLGo
- macOS
- Linux
- Windows
- WebAssembly
-
ABI0 stack-based ABI
-
ABIInternal register-based Go calling convention proposal
- amd64 arm64 ppc64/ppc64le riscv64 loong64
- Supports type parameters (generics)
- Supports generic type aliases
- Supports generic methods (Go 1.27)
go install github.com/goplus/ixgo/cmd/ixgo@latestgo install github.com/goplus/ixgo/cmd/qexp@latestixgo # ixgo repl mode
ixgo run # run a Go/XGo package
ixgo build # compile a Go/XGo package
ixgo test # test a package
ixgo version # print version
ixgo export # export Go package to ixgo builtin package
Usage: ixgo run [build flags] [package] [arguments...]
-exp-gc
experimental support runtime.GC
-mod value
module download mode to use: readonly, vendor, or mod.
-ssa
print SSA instruction code
-ssa-trace
trace SSA interpreter code
-tags value
a comma-separated list of build tags to consider satisfied during the build
-v print the names of packages as they are compiled.
-x print the commands.
ixgo # run repl mode, support Go/XGo
ixgo repl # run repl mode, support Go/XGo
ixgo repl -go # run repl mode, disable XGo syntax- test -fuzz
- test -cover
Alternative to reflectx icall stubs: tagged MakeFunc ifn. Needs a
patched Go 1.25.x, 1.26.x, or 1.27.x and -tags goplus.ifacefuncval.
Supported GOARCH: wasm, arm64, amd64, 386.
go install github.com/goplus/reflectx/cmd/iface_patch@latest
iface_patch /path/to/go
cd /path/to/go/src && ./make.bash
export GOROOT=/path/to/go
export PATH="$GOROOT/bin:$PATH"
go test -tags goplus.ifacefuncval .Without the tag, a patched compiler matches official gc. An unpatched compiler still accepts the tag; interface method calls then trap.
You can export GOFLAGS='-tags=goplus.ifacefuncval', or prefix a command:
GOFLAGS='-tags=goplus.ifacefuncval' go build (also go run / go test).
See goplus/reflectx cmd/iface_patch.
package main
import (
"github.com/goplus/ixgo"
_ "github.com/goplus/ixgo/pkg/fmt"
)
var source = `
package main
import "fmt"
func main() {
fmt.Println("Hello, World")
}
`
func main() {
_, err := ixgo.RunFile("main.go", source, nil, 0)
if err != nil {
panic(err)
}
}package main
import (
"github.com/goplus/ixgo"
_ "github.com/goplus/ixgo/xgobuild"
)
var source = `
languages := [
"C",
"Go",
"Python",
"JavaScript",
]
echo "XGo :=", languages.join(" * "), "+ Scratch"
`
func main() {
_, err := ixgo.RunFile("main.xgo", source, nil, 0)
if err != nil {
panic(err)
}
}go install -tags linknamefix -ldflags="-checklinkname=0" github.com/goplus/ixgo/cmd/ixgo@latestuse runtime linkname for faster performance iter.Pull/iter.Pull2