fstemporarydir

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 8 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSTemporaryDir

type FSTemporaryDir struct {
	// contains filtered or unexported fields
}

FSTemporaryDir hands out sandboxes inside a single parent directory owned by this process.

One parent rather than one directory per sandbox is what makes cleanup a single removal, and what makes an interrupted run leave one identifiable directory instead of a scattering of them. The owning process id is in the name so a later run can tell an abandoned parent from one that is still in use.

func New

func New(prefix string) *FSTemporaryDir

func (*FSTemporaryDir) New

func (f *FSTemporaryDir) New() string

New returns a fresh directory inside this process's parent, creating the parent on first use.

func (*FSTemporaryDir) RemoveAll added in v0.2.0

func (f *FSTemporaryDir) RemoveAll() error

RemoveAll deletes every sandbox this process handed out, and the parent.

It reports the failure rather than panicking. This runs as cleanup, often while a test is already failing for its own reasons, and a panic here would replace that diagnosis with one about a temporary directory. A parent that survives is named after a process id, so it is reclaimable rather than lost.

Jump to

Keyboard shortcuts

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