utils

package
v0.0.0-...-41bf266 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: CC0-1.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAndLog

func CloseAndLog(level logrus.Level, close func() error)

func CloseFileAndLogError

func CloseFileAndLogError(f *os.File)

CloseFileAndLogError closes a file and logs any errors

func ContainsString

func ContainsString(sa []string, os string) bool

ContainsString returns true if `os` is in the array `sa` and false if it is not.

func Dedup

func Dedup(slice []string) []string

Dedup is function that takes a string slice and removes any duplicates.

func DeleteDirectoryContents

func DeleteDirectoryContents(dirToDelete string) (filesDeleted int, err error)

func FromEnv

func FromEnv(key, otherwise string) string

FromEnv always returns a string that is either a non-empty value from the environment variable named by key or the string otherwise

func GetDirPath

func GetDirPath(dir string) (string, error)

Look for a directory by increasingly looking up the directory tree by appending '.../' It will look a max of 5 levels up before accepting failure and returning an empty string and an error

func GetEnvBool

func GetEnvBool(varName string, defaultVal bool) bool

func GetEnvInt

func GetEnvInt(varName string, defaultVal int) int

func IsUUID

func IsUUID(s string) bool

IsUUID returns true if `s` is a UUID.

Types

This section is empty.

Jump to

Keyboard shortcuts

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