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

generation

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package generation is the dependency-neutral generation I/O boundary. It authenticates publisher-validated artifacts by seal; semantic validation stays in export. It never imports graph, query, export, or an SQL driver.

Index

Constants

View Source
const BoundGoProfile = "captured-go-structural-v1"
View Source
const ChildDiscoveryFingerprint = "nested-git-roots-v1-strict"
View Source
const DiscoveryFingerprint = "detect-ignore-v1-strict-inventory-v1"
View Source
const ExtractorFingerprint = "pipeline-build-v3-closed-go-v1"
View Source
const InventoryVersion = 2

Variables

This section is empty.

Functions

func Adopted

func Adopted(out string) bool

func Candidate

func Candidate(path string) (bool, error)

Candidate preserves selected unavailable corpora instead of skipping their dangling compatibility path in favor of a different repository/global graph.

func CanonicalRoot

func CanonicalRoot(root string) (string, error)

func CheckInventory

func CheckInventory(m *types.Manifest) (stale []string, err error)

CheckInventory does not consult mutable child selections. Aggregate manifests embed everything needed for freshness after child generation reclamation.

func CheckLegacy

func CheckLegacy(m *types.Manifest) (stale []string, err error)

Legacy verification may establish a changed/deleted file, never completeness. Permission errors and nonregular paths are uncertainty, not deletion.

func CheckLegacyTargets

func CheckLegacyTargets(out string) error

Call under the output writer lock. Fixed artifact and temporary names may not redirect writes into another output's selected/sealed generation.

func DiscoverChildRoots

func DiscoverChildRoots(root string) ([]string, error)

DiscoverChildRoots follows the existing nested-repository discovery shape, but treats inaccessible .git probes as errors rather than missing children.

func Initialize

func Initialize(out string) error

func Inventory

func Inventory(root string, req types.ManifestRequest) (*types.Manifest, []string, error)

Inventory uses detect's actual rule matcher and ordering (including its ANY-list semantics). Unlike detect.Walk it never swallows traversal failures. The same function supplies default build discovery and reader verification.

func LegacyWrite

func LegacyWrite(out string, write func(string) error) error

func ReadOnlyURI

func ReadOnlyURI(path string) (string, error)

func RefuseRemoval

func RefuseRemoval(target string) error

RefuseRemoval inspects canonical targets, their ancestors and nested layouts before callers alter any hooks, registry records, artifacts or lock identity. It never deletes, repairs, or reclaims anything. Inaccessible targets fail shut.

func RegularFile

func RegularFile(path string) ([]byte, error)

func RequestFingerprint

func RequestFingerprint(req types.ManifestRequest) string

func Sync

func Sync(path string) error

func ValidID

func ValidID(id string) bool

func VerifySources

func VerifySources(m *types.Manifest) (stale []string, err error)

VerifySources keeps binding, inventory freshness and extraction coverage separate. Equal live hashes alone cannot attest an opaque extractor's input.

func WithRemoval

func WithRemoval(ctx context.Context, targets []string, effects func() error) error

WithRemoval coordinates the complete operation, not an inspect-release-delete sequence. Callbacks must NOT reacquire writer/removal locks for guarded roots. Refusal is still the only behavior for adopted layouts/stable lock deletion.

Types

type Closure

type Closure struct {
	Bytes                                                          map[string][]byte
	Dirs                                                           []string
	Files                                                          []types.ManifestFile
	DirectoryFingerprint, ConfigFingerprint, DependencyFingerprint string
}

ClosedInputs records the filesystem profile the default Go structural extractor can inspect: all Go files (including ignored candidates), config, and directory existence. Generated/VCS stores cannot be import targets in this profile; pipeline validates imports before running on the private tree.

func ClosedInputs

func ClosedInputs(root string) (*Closure, error)

type Lock

type Lock struct {
	Dir string
	// contains filtered or unexported fields
}

func Acquire

func Acquire(ctx context.Context, out string) (*Lock, error)

func (*Lock) Close

func (l *Lock) Close() error

type Seal

type Seal struct {
	ID       string            `json:"id"`
	Previous string            `json:"previous,omitempty"`
	Sequence uint64            `json:"sequence"`
	Hashes   map[string]string `json:"hashes"`
}

type Selection

type Selection struct {
	ID, Dir  string
	Sequence uint64
	Manifest *types.Manifest
}

func Pin

func Pin(path string) (*Selection, error)

Pin accepts artifact entrypoints, output-directory aliases and explicit generation paths. Related reads must use returned Dir, never resolve again.

func Resolve

func Resolve(out string) (*Selection, error)

func Validate

func Validate(dir string) (*Selection, error)

Jump to

Keyboard shortcuts

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