utils

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertEnv

func ConvertEnv(env map[string]string) []string

ConvertEnv converts map representing the environment to array of strings in the form "key=value"

func FileExists

func FileExists(file string) bool

FileExists checks if the file exists

func IsExitError

func IsExitError(err error) bool

IsExitError checks if given error is an instance of exec.ExitError

func IsURL

func IsURL(s string) bool

IsURL checks if given string is a valid URL

func LastLine

func LastLine(r io.Reader) (l string)

LastLine returns last line from provided reader

func MapKeys

func MapKeys(m interface{}) (keys []string)

MapKeys returns an array of map's keys

func MustGetUserHomeDir added in v1.0.6

func MustGetUserHomeDir() string

MustGetUserHomeDir returns current working directory. Panics is os.UserHomeDir() returns error

func MustGetwd added in v1.0.6

func MustGetwd() string

MustGetwd returns current working directory. Panics is os.Getwd() returns error

func RenderString

func RenderString(tmpl string, variables map[string]string) (string, error)

RenderString parses given string as a template and executes it with provided params

Types

type Binary

type Binary struct {
	Bin  string
	Args []string
}

Binary is a structure for storing binary file path and arguments that should be passed on binary's invocation

Jump to

Keyboard shortcuts

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