importcheck

package
v0.10.0 Latest Latest
Warning

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

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

Documentation

Overview

Package importcheck answers which non-test Go files in this module import a package.

It exists for the packages that must have NO PRODUCTION CALLER: the scripted stand-in for GitHub, the backend that fabricates completions, the replay harness that drives both. Each says so in its doc comment, and a comment is undone one line at a time; what cannot be undone quietly is the import graph. One walker rather than one per package, because a second copy of the rules below (which directories are another checkout, which are a nested module) is the one that goes stale.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModuleRoot

func ModuleRoot(tb testing.TB) string

ModuleRoot finds the directory holding go.mod above the working directory.

func ProductionImporters

func ProductionImporters(tb testing.TB, importPath string, testSide ...string) []string

ProductionImporters lists every non-test Go file in this module, relative to the module root, that imports importPath, except files in the testSide packages.

A TEST-SIDE IMPORTER IS NAMED, NOT INFERRED. The replay harness is a package of non-test files that imports the scripted service and the simulated backend, and it is exactly as test-side as they are; what makes that safe to exempt is that the harness carries this same test for itself, so the chain ends at a package nothing in production reaches. A caller names each such package and takes on that obligation; nothing here guesses from a file's imports which packages are test-side.

NAMED EXCLUSIONS, NOT EVERY HIDDEN DIRECTORY. A hidden directory can hold Go source that ships, so only what is provably not this tree is skipped: the object store, a vendored tree, and another CHECKOUT of this module, which is a directory under .claude (where sessions park worktrees) whose go.mod declares the same module path. Both conditions, because a nested directory anywhere else declaring this module's path is not a checkout, it is a way past this walk, and it is walked. A NESTED module with a path of its own is walked too: tools/lint is one, and a nested module can reach this module's internals through a replace directive, so a shipping tool under one is exactly a production importer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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