util

package
v0.0.0-...-409007c Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtoI

func AtoI(s string) int

func Coalesce

func Coalesce(v ...interface{}) interface{}

For the list of arguments, return first that is not undefined (nil)

func IsFile

func IsFile(path string) bool

func Mkdir

func Mkdir(path string)

func PrintDirTree

func PrintDirTree(root string) error

func QuotedList

func QuotedList(l interface{}, separator string) string

Splits given string on separator, and joins the bits quoted with "". A half-hearted attempt, no escaping.

func ReadDir

func ReadDir(path string) []os.FileInfo

func ReadYaml

func ReadYaml(path string, target interface{})
func ResolveLink(path string) string

func SafeMatch

func SafeMatch(s interface{}, re string) bool

func SafeReplaceAllString

func SafeReplaceAllString(s interface{}, re string, replacement string) string

func SafeToLower

func SafeToLower(s interface{}) string

func SafeValue

func SafeValue(s interface{}) string

func Sequence

func Sequence(start, length int) []int

func SlurpFile

func SlurpFile(path string) []byte

func SlurpFileAsLines

func SlurpFileAsLines(path string) []string

func SupressLogForTest

func SupressLogForTest(t *testing.T, l *log.Logger) func()

func TimeOffset

func TimeOffset(seed string) int

Give a number between 0 and 60 that somehow represents the given string. seed is not seed at all.

func ToString

func ToString(i interface{}) string

func Touch

func Touch(path string)

func WriteFile

func WriteFile(path string, content []byte)

func WriteYaml

func WriteYaml(path string, source interface{})

Types

type AnyMap

type AnyMap = map[string]interface{}

Jump to

Keyboard shortcuts

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