Documentation ¶
Overview ¶
Package skycfg is an extension library for the Starlark language that adds support for constructing Protocol Buffer messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsProtoMessage ¶
AsProtoMessage returns a Protobuf message underlying the given Starlark value, which must have been created by NewProtoMessage(). Returns (_, false) if the value is not a valid message.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
A Config is a Skycfg config file that has been fully loaded and is ready for execution.
func (*Config) Globals ¶
func (c *Config) Globals() starlark.StringDict
Globals returns the set of variables in the Starlark global namespace, including any added to the config loader by WithGlobals().
func (*Config) Locals ¶
func (c *Config) Locals() starlark.StringDict
Locals returns the set of variables in the Starlark local namespace for the top-level module.
type ExecOption ¶
type ExecOption interface {
// contains filtered or unexported methods
}
An ExecOption adjusts details of how a Skycfg config's main function is executed.
func WithVars ¶
func WithVars(vars starlark.StringDict) ExecOption
WithVars adds key:value pairs to the ctx.vars dict passed to main().
type FileReader ¶
type FileReader interface { // Resolve parses the "name" part of load("name", "symbol") to a path. This // is not required to correspond to a true path on the filesystem, but should // be "absolute" within the semantics of this FileReader. // // fromPath will be empty when loading the root module passed to Load(). Resolve(ctx context.Context, name, fromPath string) (path string, err error) // ReadFile reads the content of the file at the given path, which was // returned from Resolve(). ReadFile(ctx context.Context, path string) ([]byte, error) }
A FileReader controls how load() calls resolve and read other modules.
func LocalFileReader ¶
func LocalFileReader(root string) FileReader
LocalFileReader returns a FileReader that resolves and loads files from within a given filesystem directory.
type FnLoadOption ¶
type FnLoadOption func(*LoadOptions)
func (FnLoadOption) ApplyLoad ¶
func (fn FnLoadOption) ApplyLoad(opts *LoadOptions)
type LoadOption ¶
type LoadOption interface {
ApplyLoad(*LoadOptions)
}
A LoadOption adjusts details of how Skycfg configs are loaded.
func WithFileReader ¶
func WithFileReader(r FileReader) LoadOption
WithFileReader changes the implementation of load() when loading a Skycfg config.
func WithGlobals ¶
func WithGlobals(globals starlark.StringDict) LoadOption
WithGlobals adds additional global symbols to the Starlark environment when loading a Skycfg config.
func WithProtoRegistry ¶
func WithProtoRegistry(r unstableProtoRegistry) LoadOption
WithProtoRegistry is an EXPERIMENTAL and UNSTABLE option to override how Protobuf message type names are mapped to Go types.
type LoadOptions ¶
type LoadOptions struct { Globals starlark.StringDict FileReader FileReader ProtoRegistry impl.ProtoRegistry }
Directories ¶
Path | Synopsis |
---|---|
Package gogocompat is a compatibility shim for GoGo.
|
Package gogocompat is a compatibility shim for GoGo. |
internal
|
|