Documentation
¶
Overview ¶
Package yaegi provides a script engine implementation using the Yaegi Go interpreter (https://github.com/traefik/yaegi). It allows executing Go source code as scripts at runtime without compilation.
Construction:
eng, err := yaegi.New(ctx)
eng.Init(ctx)
eng.LoadString(ctx, "hello", `fmt.Println("hello world")`)
result, err := eng.Execute(ctx)
The engine supports hot-reload via StartWatch/StopWatch when the bound Source implements the Watcher interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrYaegiEngineNotInitialized is returned when an operation is invoked // before Init or after Close. ErrYaegiEngineNotInitialized = errors.New("yaegi engine not initialized") // ErrYaegiEngineAlreadyInitialized is returned when Init is called on an // already-initialized engine. ErrYaegiEngineAlreadyInitialized = errors.New("yaegi engine already initialized") // ErrYaegiInterpreterNotInitialized is returned when the underlying yaegi // interpreter is nil. ErrYaegiInterpreterNotInitialized = errors.New("yaegi interpreter not initialized") // ErrYaegiEvalFailed is returned when evaluating a script fails. ErrYaegiEvalFailed = errors.New("yaegi eval failed") // ErrYaegiNoScriptLoaded is returned when Execute is called but no script // has been loaded yet. ErrYaegiNoScriptLoaded = errors.New("yaegi no script loaded") // ErrYaegiFunctionNotFound is returned when CallFunction cannot find the // named function in the interpreter. ErrYaegiFunctionNotFound = errors.New("yaegi function not found") )
Sentinel errors returned by the Yaegi engine.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.