util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempFile added in v0.2.0

func CreateTempFile(prefix, content string) (string, func(), error)

CreateTempFile creates a new file in default temporary directory and returns a function for removing it later

func EnsureCommands

func EnsureCommands(names ...string) error

EnsureCommands ensures the given commands are available

func EnsureEnvVars

func EnsureEnvVars(names ...string) error

EnsureEnvVars ensures the given environment variables are set

Types

type HTTPError

type HTTPError struct {
	Request    *http.Request
	StatusCode int
	Body       string
}

HTTPError is an error for http requests

func NewHTTPError

func NewHTTPError(res *http.Response) *HTTPError

NewHTTPError creates a new instance of HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

type HTTPResult

type HTTPResult struct {
	Res *http.Response
	Err error
}

HTTPResult is the result of an http request

type ResetFunc

type ResetFunc func() error

ResetFunc is the type for a reset function

func SetEnvVars

func SetEnvVars(keyVals ...string) (ResetFunc, error)

SetEnvVars set a set of environment variables and returns a reset function for restoring them

Jump to

Keyboard shortcuts

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