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.
Click to show internal directories.
Click to hide internal directories.