command

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 13 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 command implements the `command` rule type (spec §5): the interim escape hatch for toolchain gates that cannot be expressed declaratively. It runs an external command at the repository root and interprets its exit code (and optionally its output). It is a heavy, whole-run rule: a failure to execute the tool is an engine error (exit 2), never a silent pass (spec §11). Every command rule is enumerated by `formwork lint` (spec §9).

The tool runs with the caller's environment INHERITED UNCHANGED — that is the escape hatch's contract, and this package removes nothing from it. It refuses two states instead, both in ensureRepositoryAgreement, and refusing is what lets the contract stand: nothing is deleted from the tool's environment.

  • an ambient POINTER variable (GIT_DIR, GIT_WORK_TREE, GIT_COMMON_DIR) naming a repository other than the one the engine is checking — the one state an identity comparison can SEE (#177);
  • any of the OBJECT-STORE family being set at all, which moves which commits and objects git answers from INSIDE the right repository and so is invisible to that comparison (#213).

Both are exit 2, never a finding, and both are lifted by FORMWORK_GIT_ENV= inherit — the same hatch internal/vcs uses, so an operator who has already taken that decision does not meet a second refusal spelled differently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCompiledBinary

func WithCompiledBinary(c rules.Checker, binary string, progArgs []string, workDir string) (rules.Checker, bool)

WithCompiledBinary returns a checker that runs binary with progArgs instead of the original go-run argv. workDir, when non-empty, overrides FinalizeContext.Root as the subprocess cwd (needed for go -C shapes). Returns false when c is not a command checker — callers fall back to the original argv.

Used only by fixturetest compile-once. The formwork check path never calls this, so production evaluation keeps cold go-run semantics. The returned checker collapses non-zero exits to match `go run` (exit 1 + "exit status N" on CombinedOutput) so formwork test and formwork check observe the same codes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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