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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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