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

negcontrol

package
v0.262.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package negcontrol is the shared result of a negative control, which the dialects produce and the umbra driver reports. See docs/negative-controls.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, root *cli.Command, argv []string) error

Run runs argv on root in-process with urfave's exit globals swapped out. Not safe to call concurrently. See docs/negative-controls.md.

func Summarize

func Summarize(cs []Control) (held int, failed []string)

Summarize counts passing controls and names every failure, so a run cannot report a pass while omitting a rule it could not hold.

Types

type Control

type Control struct {
	Kind        string // "never", "withhold", or "spec never"
	Rule        string // the refused path, e.g. "config set"
	Argv        []string
	Refused     bool   // the shipped guardfile refused with this rule's own text
	LoadBearing bool   // removing the rule changed the observed outcome
	Observed    string // what the shipped guardfile did
	Without     string // what it did with the rule removed
}

Control is one rule's result.

func Judge

func Judge(kind, rule string, argv []string, got, without Outcome, want string, denied int) Control

Judge builds a Control from the two observed outcomes. want is the rule's own refusal text: exit 2 alone would pass on a refusal that came from elsewhere.

func (Control) Holds

func (c Control) Holds() bool

Holds reports whether the control passes: refused by its own text, and removing it would let something different happen.

type Outcome

type Outcome struct {
	Spawned bool
	Code    int
	Text    string
}

Outcome is what one invocation did, observed rather than read off the tree.

func (Outcome) String

func (o Outcome) String() string

Jump to

Keyboard shortcuts

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