once

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package once provides a mechanism to execute a callback function exactly once per unique call site during test execution.

Use this package when you need one-time setup that should only execute once even when called from multiple parallel subtests or test iterations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(t *testing.T, callback func())

Do executes the callback exactly once per test or subtest. Using `go test -count=N` will cause the callback to be executed only once across all N runs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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