util

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 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

View Source
var ErrEnvNotSet = errors.New("environment variable not set")
View Source
var ErrUnsupportedEnvType = errors.New("unsupported env type")

Functions

func AddToTar

func AddToTar(tarWriter *tar.Writer, filePath, archivePath string) error

func BinaryWithRuntimeExtension added in v0.0.18

func BinaryWithRuntimeExtension(stem string) string

func CheckExist

func CheckExist(path string) error

func Clamp

func Clamp(v, minV, maxV int) int

func CoalescePtr

func CoalescePtr[T any](values ...*T) *T

func ContainsMainGo

func ContainsMainGo(dir string) bool

func FindGoModDir

func FindGoModDir(startDir string) string

func FindMainGoFile

func FindMainGoFile(binaryPath string) (string, error)

func FlattenEnvs added in v0.0.18

func FlattenEnvs(envs map[string]string) []string

func FormatBytes

func FormatBytes(bytes uint64) string

func GetEnv

func GetEnv[T any](key string) (*T, error)

func GetEnvWithNoErr added in v0.0.18

func GetEnvWithNoErr[T any](key string) *T

func IsExcludedSourceDir added in v0.0.18

func IsExcludedSourceDir(name string) bool

func IsExecutableFile added in v0.0.18

func IsExecutableFile(filePath string) bool

func MatchAnyFilepathGlob

func MatchAnyFilepathGlob(file string, patterns []string) bool

func MultiWriter added in v0.0.18

func MultiWriter(writers ...io.Writer) io.Writer

func NilAsZero

func NilAsZero[T any](opt *T) T

func NormalizeExePath

func NormalizeExePath(path string) string

func PIDsByExePath added in v0.0.18

func PIDsByExePath() (map[string][]int, error)

func ProcessCountByExePath added in v0.0.18

func ProcessCountByExePath() (map[string]int, error)

func ProcessesByExePath added in v0.0.18

func ProcessesByExePath() (map[string][]*process.Process, error)

func SetEnvs

func SetEnvs(envMap map[string]string) (func(), error)

func StderrIsTerminal added in v0.0.18

func StderrIsTerminal() bool

func StdoutIsTerminal

func StdoutIsTerminal() bool

Types

type TempStorageInfo

type TempStorageInfo struct {
	InMemory      bool
	AvailableDisk uint64
}

func ResolveTempStorageInfo

func ResolveTempStorageInfo(tempRoot string) TempStorageInfo

type WriterFunc added in v0.0.18

type WriterFunc func(p []byte) (n int, err error)

func (WriterFunc) Write added in v0.0.18

func (f WriterFunc) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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