tempdir

package
v0.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// These will be used as part of the names of the temporary directories to
	// make them identifiable.
	DebugStepDiffsDirNamePart = "debug-step-diffs-"
	GoldenTestRenderNamePart  = "golden-test-"
	ScratchDirNamePart        = "scratch-"
	TemplateDirNamePart       = "template-copy-"
	UpgradeMergeDirNamePart   = "upgrade-merge-"
	GitDiffDirNamePart        = "git-diff-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirTracker

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

DirTracker helps manage the removal of temporary directories when rendering is finished.

func NewDirTracker

func NewDirTracker(fs common.FS, keepTempDirs bool) *DirTracker

NewDirTracker constructs a DirTracker. Use this instead of creating a DirTracker yourself.

keepTempDirs is like a no-op flag; it preserves the temp dirs for debugging rather than removing them.

func (*DirTracker) DeferMaybeRemoveAll

func (t *DirTracker) DeferMaybeRemoveAll(ctx context.Context, outErr *error)

DeferMaybeRemoveAll should be called in a defer to clean up temp dirs, like this:

defer t.DeferMaybeRemoveAll(ctx, &rErr)

func (*DirTracker) MkdirTempTracked

func (t *DirTracker) MkdirTempTracked(dir, pattern string) (string, error)

MkdirTempTracked calls MkdirTemp and also tracks the resulting directory for later cleanup.

func (*DirTracker) Track

func (t *DirTracker) Track(dir string)

Track adds dir to the list of directories to remove.

Jump to

Keyboard shortcuts

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