testinputs

package
v0.96.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package testinputs puts a subprocess's source files into the calling test's Go test cache key.

Go keys a cached test result on the test binary and on the files and directories the test itself opened. A test that runs `go run <module>/cmd/gofastr` depends on the generator's source, but the subprocess's reads are not the test's, so after the generator changes Go replays the old result. cmd/affected already adds the edge for package selection (addCommandRuns); this adds it to the cache key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(t testing.TB, importPath string) []string

Command lists every package in the main module that importPath builds from, itself included, and reads each one's directory, its embedded files, and every directory between the two. Go's test cache records those reads: a directory's listing carries each entry's name, size and mtime, so an edited, added or removed source file changes the key. It returns the paths it read.

Call it in the test that runs the command, before or after the run.

Types

This section is empty.

Jump to

Keyboard shortcuts

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