util

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

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