util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigBytesStandin = "I am but a poor cup executable that was unable to marshal my config."

Variables

This section is empty.

Functions

func AskUserForBool

func AskUserForBool(question string, defaultValue bool) (bool, error)

func AskUserForString

func AskUserForString(question string, defaultValue string) (string, error)

func CheckFileExists

func CheckFileExists(path string) (bool, error)

func CheckIsStdin

func CheckIsStdin() (bool, error)

func CountOccurrences

func CountOccurrences(sl []string, s string) int

func GenUserAgent

func GenUserAgent(cupInfo types.CupInfo, cupConfig *config.CupConfig) string

func GetSmallerDuration

func GetSmallerDuration(d1, d2 time.Duration) time.Duration

func GetStringSliceMode

func GetStringSliceMode(sl []string) []string

func LoadViperConfigFromStruct

func LoadViperConfigFromStruct(cfg interface{}) error

LoadViperConfigFromStruct back-populates viper with the content of a struct.

func PrettyPrintSYaml

func PrettyPrintSYaml(t interface{}) (string, error)

PrettyPrintSYaml generates a pretty-ish YAML string

func StringSliceContains

func StringSliceContains(s []string, str string) bool

StringSliceContains returns `true` if the passed in string slice contains the passed in string, otherwise returns false.

Types

type RetryTimer

type RetryTimer struct {
	// contains filtered or unexported fields
}

func NewRetryTimer

func NewRetryTimer(backoffFactor int, maxWaitTime time.Duration) RetryTimer

func (*RetryTimer) AttemptFailed

func (r *RetryTimer) AttemptFailed()

func (*RetryTimer) GetRetryDelay

func (r *RetryTimer) GetRetryDelay() time.Duration

Jump to

Keyboard shortcuts

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