fstemporarydir

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 8 Imported by: 0

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