spec

package
v0.5.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package spec reads and validates platformgo.yaml, the description of a project.

Index

Constants

View Source
const FileName = "platformgo.yaml"

FileName is the description file in the project root.

View Source
const SchemaVersion = 1

SchemaVersion is the file format this platformgo understands.

Variables

This section is empty.

Functions

func JSONSchema added in v0.2.2

func JSONSchema() ([]byte, error)

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.

func SchemaURL added in v0.2.2

func SchemaURL(version string) string

SchemaURL is where the JSON schema of platformgo.yaml is published for a version. Editors that follow yaml-language-server read it from the first line of the file.

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 Load

func Load(path string) (*File, error)

Load reads the description file and validates it.

func Parse

func Parse(raw []byte) (*File, error)

Parse reads the description from bytes.

func (*File) EnabledModules

func (f *File) EnabledModules() []registry.Module

EnabledModules returns modules in dependency order: dependencies come first. The order is stable, so generated files do not change between runs.

func (*File) Service

func (f *File) Service() string

Service returns the service name: from the file, or the last element of the module path.

type Project

type Project struct {
	Module  string `yaml:"module"`  // Go module path
	Service string `yaml:"service"` // service name in logs
	Go      string `yaml:"go"`      // Go version
}

Project describes the project itself.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL