util

package
v3.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string, closeCloser func(io.Closer)) error

CopyFile copies file from src to dst

func CopyStringMap

func CopyStringMap(mp map[string]string) map[string]string

CopyStringMap returns a copy of mp

func DirectoryChecksum

func DirectoryChecksum(inputDir string) (string, error)

DirectoryChecksum returns a hash of directory contents.

func ExecuteTemplate

func ExecuteTemplate(tmplString string, os, arch string, vars map[string]string) (string, error)

ExecuteTemplate executes a template

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 Must

func Must(err error)

Must is a single place to do all our error panics

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()

Types

This section is empty.

Jump to

Keyboard shortcuts

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