util

package
v0.0.0-...-4471eec Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

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

func Download

func Download(url string) (resp *http.Response, err error)

Request a given URL and return an io.Reader

func FolderExists

func FolderExists(path *string) (bool, error)

func GetFileSize

func GetFileSize(path string) (int64, error)

func Go

func Go(f func() error) chan error

Go is a basic promise implementation: it wraps calls a function in a goroutine, and returns a channel which will later return the function's return value.

func IsURL

func IsURL(str string) bool

func ParseKeyValueOpt

func ParseKeyValueOpt(opt string) (string, string, error)

func ReadSymlinkedDirectory

func ReadSymlinkedDirectory(path string) (string, error)

ReadSymlinkedDirectory returns the target directory of a symlink. The target of the symbolic link may not be a file.

func SecureCompare

func SecureCompare(x string, y string) bool

SecureCompare performs a constant time compare of two strings to limit timing attacks.

func SelfPath

func SelfPath() string

Figure out the absolute path of our own binary (if it's still around).

func TimeToMicroseconds

func TimeToMicroseconds(t time.Time) int64

func TreeSize

func TreeSize(dir string) (size int64, err error)

TreeSize walks a directory tree and returns its total size in bytes.

func Trunc

func Trunc(s string, maxlen int) string

func ValidateContextDirectory

func ValidateContextDirectory(srcPath string) error

ValidateContextDirectory checks if all the contents of the directory can be read and returns an error if some files can't be read symlinks which point to non-existing files don't trigger an error

Types

type EnhancedTime

type EnhancedTime time.Time

type KeyValuePair

type KeyValuePair struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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