Documentation
¶
Overview ¶
Package testsupport provides shared helpers for subprocess-based tests. It is an internal package and must not be imported from non-test code outside this module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModuleRoot ¶
func ModuleRoot() string
ModuleRoot returns the absolute path to the repository module root — the directory containing go.mod. It is determined by ascending from this source file's own location, so it works correctly for any developer who clones the repository regardless of their local directory layout.
Subprocess-based tests (those that exec go build / go test / go run) must run from the module root so that relative package patterns such as "./cmd/loopctl/" resolve correctly. Use ModuleRoot() as the value of exec.Cmd.Dir in those tests.
ModuleRoot panics if the module root cannot be located; this is intentional because subprocess tests cannot proceed without it.
Types ¶
This section is empty.