standin

package
v0.201.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 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 standin writes the executables tests run in place of a real tool: a shell script that prints what a scanner would, a fake `go` or `pip`, a git hook.

A test that writes an executable and runs it straight away can fail with "text file busy" (ETXTBSY) when another test in the same process starts a program at the same moment. The forked child gets a copy of every open file, the half-written script included, and keeps it until it execs; Linux refuses to run a file that is open for writing anywhere (https://github.com/golang/go/issues/22315). Write holds syscall.ForkLock for reading while the file is open. Go takes that lock for writing around every fork, so no child is forked while the file is open and none can inherit it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(t testing.TB, path string, body []byte, mode os.FileMode)

Write writes body to path with mode, as os.WriteFile does, so that it can be run as soon as Write returns. It fails the test on an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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