How to Use Yaegi as a Go Interpreter for Scripting

Yaegi is a Go interpreter that runs scripts instantly without compilation, installed via go install and executed with the yaegi command.

Yaegi is a standalone Go interpreter that executes Go source code without compiling it to a binary, allowing you to run scripts directly. Install it via go install github.com/traefik/yaegi/cmd/yaegi@latest and run your script with yaegi script.go.

go install github.com/traefik/yaegi/cmd/yaegi@latest
yaegi script.go

Alternatively, embed it in your application by importing "github.com/traefik/yaegi/interp" and calling interp.New() to create an interpreter instance, then use i.Eval() to execute code strings.