Documentation
¶
Index ¶
- func DeleteEmptyDirs(dir string) error
- func DirCleanUpPaths(target string, preserve []string) ([]string, error)
- func FilepathJoiner(base string) func(string) string
- func FindClosestMatchingRoot(path string, roots []string) string
- func FreePort(preferred ...int) (port int, err error)
- func Map[T, U any](a []T, f func(T) U) []U
- func Must[T any](v T, err error) T
- func Must0(err error)
- func NullToEmpty[T any](a []T) []T
- func Pointer[T any](v T) *T
- func SafeUintToInt(u uint) int
- func SearchMap(object map[string]any, path []string) (any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteEmptyDirs ¶ added in v0.26.0
DeleteEmptyDirs will delete empty directories up to the root for a given directory.
func DirCleanUpPaths ¶ added in v0.26.2
DirCleanUpPaths will, for a given target file, list all the dirs that would be empty if the target file was deleted.
func FilepathJoiner ¶ added in v0.26.0
FilepathJoiner returns a function that joins provided path with base path.
func FindClosestMatchingRoot ¶ added in v0.26.0
FindClosestMatchingRoot finds the closest matching root for a given path. If no matching root is found, an empty string is returned.
func FreePort ¶ added in v0.31.0
FreePort returns a free port to listen on, if none of the preferred ports are available then a random free port is returned.
func Map ¶ added in v0.26.0
func Map[T, U any](a []T, f func(T) U) []U
Map applies a function to each element of a slice and returns a new slice with the results.
func Must ¶ added in v0.10.0
Must takes a value and an error (as commonly returned by Go functions) and panics if the error is not nil.
func Must0 ¶ added in v0.30.0
func Must0(err error)
Must0 an error (as commonly returned by Go functions) and panics if the error is not nil.
func NullToEmpty ¶
func NullToEmpty[T any](a []T) []T
NullToEmpty returns empty slice if provided slice is nil.
func SafeUintToInt ¶ added in v0.31.0
SafeUintToInt will convert a uint to an int, clamping the result to math.MaxInt.
Types ¶
This section is empty.