guard

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package guard checks a task's diff before orch publishes it (#484): secrets that must never reach a PR, and debug leftovers a reviewer should see. It reads the diff only; what to do with a finding (block, warn, nothing) is config's guard section, applied by the engine.

Index

Constants

View Source
const (
	RuleSecrets   = "secrets"
	RuleDebug     = "debug"
	RuleProtected = "protected"
)

The rules, as config's guard keys name them.

Variables

This section is empty.

Functions

func MatchPath

func MatchPath(pattern, file string) bool

MatchPath reports whether pattern names file, as a repository path: the same path, a directory ending in "/" that holds it, or a glob whose `**` segment matches any number of directories (path.Match for the rest).

Types

type Finding

type Finding struct {
	Rule string
	File string
	Line int // 0 for a finding about the whole file
	What string
}

Finding is one thing the guard saw. It never holds the matched text, so a secret cannot leak through a log line, an event or a block reason.

func Scan

func Scan(diff string, protected ...string) []Finding

Scan reads a unified diff (`git diff`) and returns what its added lines and changed files hold, in diff order: at most one finding per line. A file the diff adds, changes, deletes or renames that matches one of protected (guard.protected_paths, #504) is one finding for the whole file.

func (Finding) String

func (f Finding) String() string

Jump to

Keyboard shortcuts

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