testbuild

package
v0.3.22 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testbuild reports how the test binary was built.

Index

Constants

View Source
const AllocBudgetsHold = !debug.Enabled && !Race

AllocBudgetsHold reports a build whose instrumentation does not allocate: neither lysdebug, whose traces allocate, nor -race.

View Source
const Race = false

Race reports a build with the race detector.

Variables

This section is empty.

Functions

func GoroutineID

func GoroutineID() uint64

GoroutineID is the calling goroutine's id, parsed from its stack header.

func RequireNoInit

func RequireNoInit(t *testing.T)

RequireNoInit fails the test of a package that runs code when it is initialised: a package-level variable the compiler cannot lay out statically (one computed by a call, a map, a slice of another variable) or an init function, in the package or the test files that share its name. A program that imports the package pays for that before main, whether or not it ever uses what was built. The check reads the runtime's init trace of the test binary, which lists only the packages that have such code. It names the package by its caller, so a test calls it directly:

func TestImportingCostsNothing(t *testing.T) { testbuild.RequireNoInit(t) }

func SkipAllocBudget

func SkipAllocBudget(t testing.TB)

SkipAllocBudget skips an allocation budget in a build whose instrumentation allocates.

Types

This section is empty.

Jump to

Keyboard shortcuts

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