util

package
v0.0.0-...-bd4c8a3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 11 Imported by: ? 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

func SwitchHome

func SwitchHome(t *testing.T, newHome string) io.Closer

Types

type AtomicFileWriter

type AtomicFileWriter interface {
	io.Writer

	Name() string
	Current() io.Reader

	AbortIfPending()
	Commit() error
}

func OpenToChange

func OpenToChange(filename string) (AtomicFileWriter, error)

type FileLock

type FileLock interface {
	// Name returns an absolute path to the locked file
	Name() string

	// Unlock releases the file lock
	Unlock()
}

func TryLockFile

func TryLockFile(filename string) (FileLock, error)

TryLockFile and the returned FileLock implements Cooperative File Locking using a ".lock"-suffixed file that is atomically created to acquire the lock.

Cooperative file locking, such as implemented here, is not enforced at any level. Instead, it relies on participating threads/processes following the same procedure before changing protected files.

type TestInDir

type TestInDir interface {
	io.Closer

	OriginalWorkDir() string
	TestDir() string

	SetupTest(t *testing.T) (*assert.Assertions, string)
}

func SetupTestInDir

func SetupTestInDir(t *testing.T) TestInDir

Jump to

Keyboard shortcuts

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