outputguard

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package outputguard prevents generators from overwriting reviewed or generated inputs that participate in the same one-way build graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(root string, inputs []Input, targets []Target) error

Validate rejects any target that is identical to, contains, or is contained by a protected input. Existing symlinks and hard links are resolved before comparison; paths that do not exist resolve through their longest existing ancestor.

func ValidateRepoTargetAllowlist

func ValidateRepoTargetAllowlist(root string, target Target, allowedRelativePaths ...string) error

ValidateRepoTargetAllowlist permits arbitrary temporary outputs outside the repository, but restricts in-repository writes to explicit canonical delivery targets. This closes transitive source-graph gaps without requiring every future input file to be rediscovered by each generator guard.

Types

type Input

type Input struct {
	Name string
	Path string
}

Input is a protected generator input. Relative paths are resolved against the generator's explicit repository root.

type Target

type Target struct {
	Name      string
	Path      string
	Directory bool
}

Target is a prospective generator output. Relative paths retain CLI semantics and are resolved against the current working directory.

Jump to

Keyboard shortcuts

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