Help us shape the future of Go! Take the 2026 Go Developer Survey

builder

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package builder validates and executes source-image build plans declared by catalog components. Coverage capabilities are declared by each product in CoverageSpec; this package validates the contract and does not identify products by name or maintain product Dockerfiles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, spec Spec, req Request) error

Build validates a specification and executes its commands in declaration order.

func BuildMany

func BuildMany(ctx context.Context, specs []Spec, req Request) error

BuildMany executes independent component build plans in declaration order.

func BuildProducts

func BuildProducts(ctx context.Context, products []Product, repoRoot string, runner Runner, coverage bool) error

BuildProducts builds products with independent versions in declaration order.

func CoverageBuildArgs

func CoverageBuildArgs(spec CoverageSpec) []string

CoverageBuildArgs returns deterministic Docker build arguments for a coverage mode.

Types

type BrowserCoverageSpec

type BrowserCoverageSpec struct {
	Supported     bool
	Include       []string
	Exclude       []string
	SourceRoot    string
	SourceMapRoot string
	OutputDir     string
}

BrowserCoverageSpec describes browser-side source files and report output.

type Command

type Command struct {
	Directory string
	Args      []string
	Env       map[string]string
}

Command is one product build command. Directory is relative to the repository root.

type CoverageSpec

type CoverageSpec struct {
	Supported   bool
	Types       []CoverageType
	Packages    []string
	Include     []string
	OutputDir   string
	BuildArgs   map[string]string
	Environment map[string]string
	Browser     BrowserCoverageSpec
}

CoverageSpec describes a product's coverage capability.

type CoverageType

type CoverageType string

CoverageType identifies the instrumentation format produced by a build.

const (
	// GoCoverage identifies Go coverage counter data.
	GoCoverage CoverageType = "go"
	// NodeV8Coverage identifies Node.js V8 coverage data.
	NodeV8Coverage CoverageType = "node-v8"
	// BrowserJSCoverage identifies JavaScript coverage collected from a Chromium page.
	BrowserJSCoverage CoverageType = "browser-js"
)

type ExecRunner

type ExecRunner struct{}

ExecRunner runs commands through the host process environment.

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, command Command) error

Run executes one command from the repository root.

type Image

type Image struct {
	Name       string
	Dockerfile string
	Context    string
}

Image describes one image produced by a component build.

type Product

type Product struct {
	Spec    Spec
	Version string
}

Product associates a build specification with the version to produce.

type Request

type Request struct {
	RepoRoot string
	Version  string
	Coverage bool
	Runner   Runner
}

Request controls one source build.

type Runner

type Runner interface {
	Run(context.Context, Command) error
}

Runner executes product build commands.

type Spec

type Spec struct {
	Component string
	SourceDir string
	Images    []Image
	Coverage  CoverageSpec
	Plan      func(root, version string, coverage CoverageSpec) ([]Command, error)
}

Spec describes how a catalog component is built from source.

Jump to

Keyboard shortcuts

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