util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagPrefix = "v"
)

Variables

This section is empty.

Functions

func AddTagPrefix added in v0.2.1

func AddTagPrefix(tag string) string

func Ask

func Ask(question, expectedResponse string, retries int) (answer string, success bool, err error)

func CopyDirContentsLocal added in v0.2.4

func CopyDirContentsLocal(src, dst string) error

CopyDirContentsLocal copies local directory contents from one local location to another.

func CopyFileLocal added in v0.2.4

func CopyFileLocal(src, dst string, required bool) error

CopyFileLocal copies a local file from one local location to another.

func EnvDefault added in v0.2.1

func EnvDefault(key, def string) string

EnvDefault returns either the provided environment variable for the given `key` or the default value `def` if not set.

func Exists added in v0.2.4

func Exists(path string) bool

Exists indicates whether a file exists.

func FakeGOPATH

func FakeGOPATH(srcDir string) (string, error)

FakeGOPATH creates a temp directory, links the base directory into it and sets the GOPATH environment variable to it.

func IsEnvSet added in v0.2.1

func IsEnvSet(key string) bool

IsEnvSet returns true if an environment variable is set

func MoreRecent added in v0.2.1

func MoreRecent(a, b string) (bool, error)

MoreRecent determines if file at path a was modified more recently than file at path b. If one file does not exist, the other will be treated as most recent. If both files do not exist or an error occurs, an error is returned.

func PackagesAvailable added in v0.2.4

func PackagesAvailable(packages ...string) (bool, error)

PackagesAvailable takes a slice of packages and determines if they are installed on the host OS. Replaces common::check_packages.

func ReadFileFromGzippedTar added in v0.2.1

func ReadFileFromGzippedTar(tarPath, filePath string) (io.Reader, error)

ReadFileFromGzippedTar opens a tarball and reads contents of a file inside.

func RemoveAndReplaceDir added in v0.2.4

func RemoveAndReplaceDir(path string) error

RemoveAndReplaceDir removes a directory and its contents then recreates it.

func SemverToTagString added in v0.2.4

func SemverToTagString(tag semver.Version) string

func TagStringToSemver added in v0.2.4

func TagStringToSemver(tag string) (semver.Version, error)

func TrimTagPrefix added in v0.2.1

func TrimTagPrefix(tag string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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