system

package
v0.0.0-...-1534dbb Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentUser = user.Current
View Source
var (
	// DefaultFileSystem allows to change the implementation of the default file system, for example for tests
	DefaultFileSystem afero.Fs = afero.NewOsFs()
)

Functions

func AssertFileContents

func AssertFileContents(t *testing.T, fs afero.Fs, path string, content string) bool

func AssertModePerm

func AssertModePerm(t testing.TB, fs afero.Fs, path, mode string) bool

func AssertPathExists

func AssertPathExists(t *testing.T, fs afero.Fs, path string, msgAndArgs ...interface{}) bool

func EnsureFileContent

func EnsureFileContent(fs afero.Fs, path string, reader io.Reader) error

func EnsureTestFileContent

func EnsureTestFileContent(t *testing.T, fs afero.Fs, path string, content string)

func Env

func Env() map[string]string

Env returns the current environment variables as a usable map

func GetenvOrDefault

func GetenvOrDefault(key, defaultValue string) string

func HomeDir

func HomeDir() (string, error)

HomeDir returns the directory a user's own files live in.

HOME decides, which is what git, ssh and curl all do, and what makes a container, a CI job or an agent sandbox that overrides it read the files it meant to rather than the ones belonging to whoever the process happens to run as. The passwd database is consulted only when HOME says nothing, where there is nothing else to go on.

func Reset

func Reset()

Reset restores the system environment as it was when the package was imported

Types

This section is empty.

Jump to

Keyboard shortcuts

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