system

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInputTooLarge = errors.New("input too large")

ErrInputTooLarge reports that input exceeds a caller-provided size limit.

Functions

func Abs

func Abs(path string) (string, error)

Abs resolves a path to an absolute path.

func ByteLimitLabel added in v0.20.2

func ByteLimitLabel(size int64) string

ByteLimitLabel formats a byte limit for user-facing messages.

func Command

func Command(name string, args ...string) *exec.Cmd

Command constructs an external process command.

func CommandContext added in v0.15.2

func CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd

CommandContext constructs an external process command bound to ctx.

func FileExists

func FileExists(path string) (bool, error)

FileExists reports whether path exists and is a file.

func Getwd

func Getwd() (string, error)

Getwd returns the current working directory.

func LookPath

func LookPath(file string) (string, error)

LookPath resolves a command on PATH.

func PathEnv

func PathEnv() string

PathEnv returns the current PATH value.

func ReadFileLimit added in v0.20.2

func ReadFileLimit(path string, maxBytes int64) ([]byte, error)

ReadFileLimit reads at most maxBytes from path.

The size is checked before reading when it is available and again while reading, so the limit also holds if the file grows after it is opened.

func ReadLimit added in v0.20.2

func ReadLimit(input io.Reader, declaredSize, maxBytes int64) ([]byte, error)

ReadLimit reads input while enforcing maxBytes. A negative declaredSize means the size is not known before reading.

func ResolveExistingFile

func ResolveExistingFile(pathValue string) (string, error)

ResolveExistingFile resolves pathValue to an absolute path and validates that it exists as a file.

func UserHomeDir

func UserHomeDir() (string, error)

UserHomeDir returns the current user's home directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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