Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanRuntime ¶
CleanRuntime strips //go:build directives, the package declaration, and import blocks from Go source so it can be emitted into a generated program.
func CollectGoDeps ¶
CollectGoDeps returns all GoDeps from the named modules (deduped, sorted).
func LookupFunc ¶
LookupFunc resolves a module function to its Go runtime wrapper name.
Types ¶
type FuncDef ¶
type FuncDef struct {
// Name is the rugo function name (e.g. "exec").
Name string
// Args lists the expected typed arguments. The wrapper will convert
// interface{} args to these types before calling the implementation.
Args []ArgType
// Variadic, when true, passes remaining args beyond Args as ...interface{}.
// The implementation function should accept extra ...interface{} as its last parameter.
Variadic bool
// Doc is the documentation string shown by `rugo doc`.
Doc string
}
FuncDef describes a function exposed by a module. The implementation function must be named <module>_<Name> in runtime.go and use typed parameters matching Args (e.g. func os_exec(command string) interface{}).
type Module ¶
type Module struct {
// Name is the rugo import name (e.g. "os", "http", "conv").
Name string
// Type is the Go struct type name used as the method receiver (e.g. "OS", "HTTP").
Type string
// Funcs describes the functions this module exposes.
Funcs []FuncDef
// GoImports lists additional Go imports this module needs beyond the base set.
GoImports []string
// GoDeps lists Go module dependencies (require lines for go.mod) that the
// generated program needs. Each entry should be "module version", e.g.
// "github.com/gosimple/slug v1.15.0". Only needed for external modules
// that depend on third-party Go packages.
GoDeps []string
// Runtime is the Go source for the struct type and its methods (from embedded runtime.go).
Runtime string
// DispatchEntry, when set, names the module function that triggers dispatch.
// The compiler generates a typed map (rugo_<mod>_dispatch) mapping user-defined
// function names to their Go implementations, which the module's runtime uses
// to route commands to handlers.
DispatchEntry string
// Doc is the module-level documentation shown by `rugo doc`.
Doc string
}
Module represents a Rugo stdlib module that can be imported.
func (*Module) FullRuntime ¶
FullRuntime returns the complete runtime source: the struct type and methods from Runtime plus auto-generated wrappers that handle interface{} conversion.