testsupport

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

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