util

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug added in v0.6.5

func Debug() bool

Debug reports whether a magefile was run with the debug flag.

func ExecOutput

func ExecOutput(cmd string, args ...string) (string, error)

ExecOutput executes a command and returns its standard output

func GitCmd added in v0.6.5

func GitCmd() string

GitCmd reports the command to use to extract git info. By default it is the "go" binary in the PATH.

func GoCmd added in v0.6.5

func GoCmd() string

GoCmd reports the command to use to build go code. By default it is the "go" binary in the PATH.

func LogIfDebug added in v0.6.6

func LogIfDebug(msg string, v ...interface{})

LogIfDebug logs message if debug flag is on.

func LogIfVerbose added in v0.6.6

func LogIfVerbose(msg string, v ...interface{})

LogIfVerbose logs message if verbose flag is on.

func Md5

func Md5(file string) (string, error)

Md5 returns md5sum for the given file

func RunCmd added in v1.0.1

func RunCmd(name string, arg ...string) error

RunCmd runs the given command displaying its standard output if in verbose mode

func Sha1

func Sha1(file string) (string, error)

Sha1 returns sha1sum for the given file

func Sha256

func Sha256(file string) (string, error)

Sha256 returns sha256sum for the given file

func TarFiles added in v1.0.6

func TarFiles(filename string, files []string, preserveDir bool) error

From https://www.arthurkoziel.com/writing-tar-gz-files-in-go/

func TrimString

func TrimString(val string) string

TrimString trims string for: ' ', '"', '\n'

func Verbose added in v0.6.5

func Verbose() bool

Verbose reports whether a magefile was run with the verbose flag.

func ZipFiles

func ZipFiles(filename string, files []string) error

ZipFiles compresses one or many files into a single zip archive file. The original code was published under MIT licence under https://golangcode.com/create-zip-files-in-go/

Types

type ChecksumDetails

type ChecksumDetails struct {
	Md5    string
	Sha1   string
	Sha256 string
}

ChecksumDetails provides check sums

func GetChecksumDetails

func GetChecksumDetails(filePath string) (ChecksumDetails, error)

GetChecksumDetails returns file checksums for a given file

type FileDetails

type FileDetails struct {
	Checksum ChecksumDetails
	Size     int64
}

FileDetails provides check sums and size for a given file

func GetFileDetails

func GetFileDetails(filePath string) (*FileDetails, error)

GetFileDetails returns file details for a given file

Jump to

Keyboard shortcuts

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