forgereach

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package forgereach answers one question for forge's CI gates: can this diff change what a consumer of forge sees?

A consumer is a project generated by forge (reliant, control-plane). It sees forge in two ways:

  • the Go packages under pkg/ it imports (and the module-internal packages those import), so a change there can break its build;
  • the code `forge generate` writes into it, so a change to the templates or the generators can break the build after the consumer regenerates.

Everything else in the module (the CLI's commands, the linters, the docs) never reaches a consumer's build, and a gate that ran on it would spend its time on diffs that cannot matter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangedFiles

func ChangedFiles(dir, base string) ([]string, error)

ChangedFiles lists the files that differ from base in the checkout at dir — uncommitted and untracked ones included — as slash paths relative to dir, sorted.

func ExportRev

func ExportRev(dir, rev, dst string) error

ExportRev writes the tree of rev into dst (git archive; no repository state).

func Git

func Git(dir string, args ...string) ([]byte, error)

Git runs git in dir and returns stdout.

func GoList

func GoList(dir string, args ...string) ([]byte, error)

GoList runs `go list args...` in dir with the workspace off and returns stdout.

Types

type Reach

type Reach struct {
	// Module is the forge module path.
	Module string
	// All is true when the module's dependency set changed (see depsChanged):
	// any consumer package that imports forge may be affected.
	All bool
	// Packages are the import paths of the changed Go packages a consumer can
	// import, directly (pkg/...) or through a package of pkg/, sorted.
	Packages []string
	// Generated are the changed files whose output lands in a consumer's tree
	// when it runs `forge generate`: templates, generators, scaffolding.
	Generated []string
}

Reach is what a diff can change for a consumer.

func Compute

func Compute(root, base string, changed []string) (Reach, error)

Compute maps the changed files (relative to the forge module at root, as differing from base) onto what a consumer can see.

func (Reach) API

func (r Reach) API() bool

API reports whether the diff can change the Go API consumers compile against.

func (Reach) Any

func (r Reach) Any() bool

Any reports whether the diff can reach a consumer at all.

func (Reach) Summary

func (r Reach) Summary() string

Summary is one line naming why a diff reaches consumers.

Jump to

Keyboard shortcuts

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