Documentation ¶
Index ¶
- func ExecCmd(cmd *exec.Cmd, output bool) error
- func FileExists(filename string) bool
- func GetEnvWithDefault(key, defaultValue string) string
- func HttpGetJSON(url string, result interface{}) error
- func HttpPostJSON(url string, request, response interface{}, httpStatusCodeToCheck int) error
- func HttpPutJSON(url string, o interface{}) error
- func IsDirectory(path string) (bool, error)
- func ReadJSONFile(fileName string) (map[string]string, error)
- func Retry(attempts int, sleep time.Duration, fn func() error) error
- func SliceContains(s *[]string, e string) bool
- func SliceContainsInt(i *[]int, e int) bool
- func SliceContainsLike(s *[]string, e string) bool
- type Stop
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnvWithDefault ¶ added in v0.2.0
GetEnvWithDefault returns the value of an enviornment variable or a default value if the environment variables is not set
func HttpGetJSON ¶ added in v0.6.0
HttpGetJSON fetches the contents of the given URL and decodes it as JSON into the given result, which should be a pointer to the expected data. returns an error if http response code is not 200
func HttpPostJSON ¶ added in v0.7.0
HttpPostJSON encodes a struct as JSON and HTTP POSTs it to the specified url. If the HTTP response's content-type is JSON, then the response is decoded into the given result. Returns an error if http response code does not match specified `httpStatusCodeToCheck`. Set `httpStatusCodeToCheck` == 0 to opt out of the check.
func HttpPutJSON ¶ added in v0.7.0
HttpPutJSON encodes a struct as JSON and HTTP PUTs it to the specified url returns an error if http response code is not 200
func IsDirectory ¶
IsDirectory returns true if a path is a directory
func ReadJSONFile ¶
ReadJSONFile reads JSON from a file
func SliceContains ¶
SliceContains returns true if a slice contains a string
func SliceContainsInt ¶ added in v0.4.0
SliceContainsInt returns true if a slice contains an int
func SliceContainsLike ¶
SliceContainsLike returns true if a slice contains a string that contains another string