Documentation
¶
Overview ¶
Package spec reads and validates platformgo.yaml, the description of a project.
Index ¶
Constants ¶
const FileName = "platformgo.yaml"
FileName is the description file in the project root.
const SchemaVersion = 1
SchemaVersion is the file format this platformgo understands.
Variables ¶
This section is empty.
Functions ¶
func JSONSchema ¶ added in v0.2.2
JSONSchema returns the JSON schema of platformgo.yaml, built from the module registry, so the editor knows exactly the modules and options this platformgo knows.
Types ¶
type File ¶
type File struct {
Schema int `yaml:"schema"`
Platform string `yaml:"platform"`
Project Project `yaml:"project"`
Modules map[string]map[string]any `yaml:"modules"`
}
File is the content of platformgo.yaml.
func (*File) DecodeOptions ¶ added in v0.9.0
DecodeOptions reads the section of a module into a typed struct with yaml tags, the way generators read their options. Defaults declared in the registry fill what the file leaves out, and an empty string counts as left out, as in StringOption. Decoding is strict: a key the struct has no field for is an error. A disabled module leaves out as it is.
func (*File) EnabledModules ¶
EnabledModules returns modules in dependency order: dependencies come first. The order is stable, so generated files do not change between runs.
func (*File) Service ¶
Service returns the service name: from the file, or the last element of the module path.
func (*File) StringOption ¶ added in v0.9.0
StringOption returns a string option of a module, or def when the module is off, the option is not set or is empty.