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

gate

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package gate evaluates explicit verification requirements independently of analyzer coverage. It cannot execute commands or authorize human approval.

Index

Constants

View Source
const MaxBytes = 1 << 20

MaxBytes bounds policy/plan input reads and parsing.

Variables

This section is empty.

Functions

func Exit

func Exit(r Result) int

func Validate

func Validate(p Policy) error

Types

type Check

type Check struct {
	ID          string         `json:"id"`
	Status      model.Status   `json:"status"`
	Evidence    model.Evidence `json:"evidence"`
	Explanation string         `json:"explanation"`
}

func NoBreaking

func NoBreaking(findings []model.Finding, unverified []string) Check

NoBreaking passes only when no supported error-severity contract finding exists AND the analysis established every declared obligation. Absence of findings alone never passes: unverified lists each reason (removed, invalid or unanalyzable declarations) that the verdict cannot be established.

type Coverage

type Coverage struct {
	Analyzer    string       `json:"analyzer"`
	Status      model.Status `json:"status"`
	Scope       []string     `json:"analyzed_scope"`
	Excluded    []string     `json:"excluded_scope"`
	Unavailable []string     `json:"unavailable_capabilities"`
	Uncertainty []string     `json:"uncertainty"`
}

func CoverageFor

func CoverageFor(checks []Check, limitations []string) []Coverage

type Policy

type Policy struct {
	Version   int      `json:"version"`
	Name      string   `json:"name,omitempty"`
	Require   []string `json:"require"`
	OnMissing string   `json:"on_missing,omitempty"`
}

func Load

func Load(path string) (Policy, error)

func Parse

func Parse(b []byte) (Policy, error)

Parse decodes the exact captured policy bytes without reopening an input file.

type Result

type Result struct {
	Verdict     Verdict `json:"verdict"`
	Policy      Policy  `json:"policy"`
	Required    []Check `json:"required_checks"`
	Explanation string  `json:"explanation"`
}

func Evaluate

func Evaluate(p Policy, checks []Check) Result

type Verdict

type Verdict string
const (
	Pass    Verdict = "pass"
	Fail    Verdict = "fail"
	Blocked Verdict = "blocked"
	Error   Verdict = "error"
)

Jump to

Keyboard shortcuts

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