util

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile copys a file from src to dst

func FileChecksum

func FileChecksum(filename string) (string, error)

FileChecksum returns the hex checksum of a file

func FileExists

func FileExists(path string) bool

FileExists asserts that a file exists

func FileExistsWithChecksum

func FileExistsWithChecksum(filename, checksum string) (bool, error)

FileExistsWithChecksum returns true if the file both exists and has a matching checksum

func HexHash

func HexHash(hasher hash.Hash, data ...[]byte) (string, error)

HexHash returns a hex representation of data's hash This will only return non-nil error if given a hasher that can return a non-nil error from Write()

func LogCloseErr

func LogCloseErr(closer io.Closer)

LogCloseErr logs errors closing closers. Useful in defer statements.

func MustHexHash

func MustHexHash(hasher hash.Hash, data ...[]byte) string

MustHexHash is like hexHash but panics on err this should only be used with hashers that are guaranteed to return a nil error from Write()

func Rm

func Rm(path string) error

Rm removes a file and filters out IsNotExist errors

func TmpDir

func TmpDir() (string, func(), error)

TmpDir returns a temp dir and a function to delete it

Types

This section is empty.

Jump to

Keyboard shortcuts

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