utils

package module
v0.0.0-...-2ccacbe Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPidFile

func CheckPidFile(program string, pidFile string) error

func CmdExists

func CmdExists(name string) bool

CmdExists check if the given command is available on the host

func CreatePidFile

func CreatePidFile(program string, pidFile string) error

CreatePidFile writes a sysbox pid to a file. If the file already exists, and its pid matches a current sysbox program, then an error is returned.

func DestroyPidFile

func DestroyPidFile(pidFile string) error

func FilepathSort

func FilepathSort(paths []string)

Sorts the give set of filepaths hierarchically; paths must be absolute.

func GetEnvVarInfo

func GetEnvVarInfo(v string) (string, string, error)

GetEnvVarInfo returns the name and value of the given environment variable

func GetFsName

func GetFsName(path string) (string, error)

func MountSliceContains

func MountSliceContains(s []specs.Mount, x specs.Mount, match func(a, b specs.Mount) bool) bool

MountSliceContains returns true if mount x is in slice s.

func MountSliceEqual

func MountSliceEqual(a, b []specs.Mount) bool

Compares the given mount slices and returns true if the match

func MountSliceRemove

func MountSliceRemove(s, db []specs.Mount, cmp func(m1, m2 specs.Mount) bool) []specs.Mount

MountSliceRemove removes from slice 's' any elements which occur on slice 'db'; the given function is used to compare elements.

func MountSliceRemoveMatch

func MountSliceRemoveMatch(s []specs.Mount, match func(specs.Mount) bool) []specs.Mount

MountSliceRemoveMatch removes from slice 's' any elements for which the 'match' function returns true.

func StringSliceContains

func StringSliceContains(a []string, x string) bool

StringSliceContains returns true if x is in a

func StringSliceEqual

func StringSliceEqual(a, b []string) bool

StringSliceEqual compares two slices and returns true if they match

func StringSliceFindShortest

func StringSliceFindShortest(s []string) string

finds the shortest string in the given slice

func StringSliceRemove

func StringSliceRemove(s, db []string) []string

StringSliceRemove removes from slice 's' any elements which occur on slice 'db'.

func StringSliceRemoveMatch

func StringSliceRemoveMatch(s []string, match func(string) bool) []string

StringSliceRemoveMatch removes from slice 's' any elements for which the 'match' function returns true.

func StringSliceUniquify

func StringSliceUniquify(s []string) []string

uniquify a string slice (i.e., remove duplicate elements)

Types

type FilepathSlice

type FilepathSlice []string

func (FilepathSlice) Len

func (fp FilepathSlice) Len() int

func (FilepathSlice) Less

func (fp FilepathSlice) Less(i, j int) bool

Compares the number of "/" separated elements in paths fp[i] and fp[j].

func (FilepathSlice) Swap

func (fp FilepathSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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