util

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyWithBackoff

func ApplyWithBackoff(f func() error) error

ApplyWithBackoff tries to apply the specified function using an exponential backoff algorithm. If the function eventually succeed nil is returned, otherwise the error returned by f.

func AppropriateToScan added in v0.0.27

func AppropriateToScan() bool

AppropriateToScan checks the current pipeline execution environment to see if it is appropriate to insert the app.

func Contains

func Contains(list []string, s string) bool

Contains checks whether the specified string is contained in the given string slice. Returns true if it does, false otherwise

func CopyFile

func CopyFile(src string, dst string) (err error)

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

func Exists

func Exists(path string) bool

Exists checks whether the specified path exists. The implementation is opinionated, since in case of unexpected errors false is returned

func FileExists added in v0.0.27

func FileExists(filename string) bool

FileExists checks if a file exists and is not a directory before we try using it to prevent further errors.

func IsBool

func IsBool(value interface{}, key string) error

IsBool checks if value stored at a given key is a bool.

func IsDirectory

func IsDirectory(path string) bool

IsDirectory checks whether the specified path is a directory. The implementation is opinionated, since in case of unexpected errors false is returned

func IsInt

func IsInt(value interface{}, key string) error

IsInt checks if values stored at a given key is an int.

func IsNotEmpty

func IsNotEmpty(value interface{}, key string) error

IsNotEmpty checks if value stored at given key is empty. if it is empty it returns an error.

func MoveFile added in v0.0.23

func MoveFile(src string, dst string) (err error)

MoveFile renames the file named src to the file named by dst. If dst already exists and is not a directory, MoveFile replaces it

func NameOfFunction

func NameOfFunction(pc uintptr) string

NameOfFunction gives name of the current function given program counter.

Types

type MultiError

type MultiError struct {
	Errors []error
}

MultiError is a collection of errors.

func (*MultiError) Collect

func (m *MultiError) Collect(err error)

Collect appends an error to this MultiError.

func (*MultiError) Empty

func (m *MultiError) Empty() bool

Empty returns true if current MuiltiError is empty, false otherwise.

Jump to

Keyboard shortcuts

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