runtimeguard

package
v0.85.0-pre.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package runtimeguard centralizes runtime/buildtime dependency-boundary checks.

Keeping roots, forbidden prefixes, dependency graph collection, and violation formatting in one place prevents drift between CI command checks and test contract checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultBuildtimeSentinelDependencyPrefixes

func DefaultBuildtimeSentinelDependencyPrefixes() []string

DefaultBuildtimeSentinelDependencyPrefixes returns default buildtime dependency prefixes expected to appear in a known buildtime root closure.

func DefaultBuildtimeSentinelRootPackagePath

func DefaultBuildtimeSentinelRootPackagePath() string

DefaultBuildtimeSentinelRootPackagePath returns the default buildtime root used by sentinel-coverage checks.

func DefaultForbiddenRuntimeDependencyPathPrefixes

func DefaultForbiddenRuntimeDependencyPathPrefixes() []string

DefaultForbiddenRuntimeDependencyPathPrefixes returns forbidden build/dev dependency prefixes for runtime roots.

func FindPresentDependencyPrefixMatches

func FindPresentDependencyPrefixMatches(
	rootPackagePath string,
	candidatePrefixes []string,
) ([]string, error)

FindPresentDependencyPrefixMatches returns candidate prefixes that are actually present in one root package dependency closure.

Types

type DependencyViolation

type DependencyViolation struct {
	RootPackagePath string
	DependencyPath  string
	MatchedPrefix   string
}

DependencyViolation records one runtime dependency-boundary failure.

type EvaluationReport

type EvaluationReport struct {
	CheckedRuntimeRoots []string
	ForbiddenPrefixes   []string
	Violations          []DependencyViolation
}

EvaluationReport captures one full dependency-boundary evaluation run.

func EvaluateDefaultRuntimeDependencyBoundaries

func EvaluateDefaultRuntimeDependencyBoundaries() (*EvaluationReport, error)

EvaluateDefaultRuntimeDependencyBoundaries evaluates default runtime roots against default forbidden build/dev dependency prefixes.

func EvaluateRuntimeDependencyBoundaries

func EvaluateRuntimeDependencyBoundaries(
	boundaryChecks []RuntimeDependencyBoundaryCheck,
	forbiddenDependencyPathPrefixes []string,
) (*EvaluationReport, error)

EvaluateRuntimeDependencyBoundaries evaluates runtime roots against forbidden dependency prefixes.

func (*EvaluationReport) FormatViolationReport

func (report *EvaluationReport) FormatViolationReport() string

FormatViolationReport formats evaluation output for CI and human debugging.

func (*EvaluationReport) HasViolations

func (report *EvaluationReport) HasViolations() bool

HasViolations reports whether any boundary violations were found.

type RuntimeDependencyBoundaryCheck

type RuntimeDependencyBoundaryCheck struct {
	RootPackagePath string
}

RuntimeDependencyBoundaryCheck defines one runtime package root whose transitive dependency closure must exclude build/dev-time packages.

func DefaultRuntimeBoundaryChecks

func DefaultRuntimeBoundaryChecks() []RuntimeDependencyBoundaryCheck

DefaultRuntimeBoundaryChecks returns the default runtime roots checked by the guard.

Jump to

Keyboard shortcuts

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