testinputs

package
v1.0.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package testinputs makes the repository files a test hands to a child process inputs of that test's cached result.

Go's test cache reuses a package's passing result while the test binary, its flags, the environment variables it read and the module files it opened or stat-ed are unchanged. A file that only a child process reads — a script run with sh or node, a docker build context, the sources of a binary built with go build — is not among them, so editing it alone would replay a stale pass. A test calls Files or GoBuild before starting that process: reading the files in the test process records them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Files

func Files(t testing.TB, paths ...string)

Files reads every regular file under each path (a file or a directory, relative to the test's working directory), and lists every directory, so a changed, added or removed file changes the test's cache key.

func GoBuild

func GoBuild(t testing.TB, dir string, env []string, pkgs ...string) []string

GoBuild reads the sources of everything `go build pkgs...` run in dir compiles from this module (go list -deps, with the build's GOOS), so a change to a binary the test builds and runs in a child process changes the test's cache key, as a change to the test's own packages does. It returns the files it read.

Types

This section is empty.

Jump to

Keyboard shortcuts

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