utils

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserOnlyMode  os.FileMode = 0700
	UserGroupMode os.FileMode = 0770
	WorldMode     os.FileMode = 0777
)

Variables

This section is empty.

Functions

func Contains

func Contains(s []string, e string) bool

func CreateDirIfNotExist added in v0.0.6

func CreateDirIfNotExist(path string, perm os.FileMode) error

CreateDirIfNotExist attempts to create the path if it does not exist

func CreateFileIfNotExist added in v0.0.6

func CreateFileIfNotExist(filePath string, perm os.FileMode) error

CreateFileIfNotExist attempts to create the path and file if it does not exist

func EnsureLink(source, target string) error

EnsureLink ensures that a link to the source exists at the target Both source and target should be full paths

func IsDirectory added in v0.0.6

func IsDirectory(path string) (bool, error)

IsDirectory returns true if the given path is a directory, false otherwise

func IsYaml added in v0.0.7

func IsYaml(s []byte) (bool, error)

IsYaml verifies that a byte string is value YAML syntax On failure, returns an error with the reason

func Retry added in v0.0.4

func Retry(attempts int, sleep time.Duration, fn func() error) error

Retry will make a given number of attempts to run the provided function sleeping between each attempt

Types

type StringReplacer added in v0.1.3

type StringReplacer string

StringReplacer represents the StringReplacer type

func (StringReplacer) ReplaceAll added in v0.1.3

func (sr StringReplacer) ReplaceAll(replace, with string) StringReplacer

ReplaceAll finds and replaces all instances of 'replace' with 'with'

func (StringReplacer) String added in v0.1.3

func (sr StringReplacer) String() string

String stringifies the StringReplacer

Jump to

Keyboard shortcuts

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