utils

package
v0.0.0-...-87137c7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPath

func AbsPath(filename string) string

AbsPath gets the absolute path

func CopyFile

func CopyFile(source string, dest string)

Copy a file from a source to a dest (intended for small files_

func Exists

func Exists(filename string) bool

Determine if a file exists

func FindDiff

func FindDiff(one []string, two []string) []string

Return strings that are in first list, but not second

func FindOverlap

func FindOverlap(one []string, two []string) []string

Return overlap in two

func GetPwd

func GetPwd() string

Wrapper to get the PWD

func IncludesString

func IncludesString(lookingFor string, list []string) bool

includesString to determine if a list include a string

func ListDir

func ListDir(path string, includeDir bool, includeFile bool) []string

Function to list directory, and either return basesnames of files, folders, or both

func RandomBool

func RandomBool() bool

RandomBool returns a random boolean choice

func RandomBoolWeight

func RandomBoolWeight(chanceTrue float32) bool

RandomBool returns a boolean choice at the user's threshold

func RandomChar

func RandomChar() string

Get a random character

func RandomChoice

func RandomChoice(choices []string) string

RandomChoice returns a random selection from a list of strings

func RandomFloat

func RandomFloat() uint64

RandomFloat returns a random floating point

func RandomFloatRange

func RandomFloatRange(min uint64, max uint64) uint64

RandomFloatRange generates a random float in a rnage

func RandomInt

func RandomInt(maxval int) int

func RandomIntRange

func RandomIntRange(min int, max int) int

func RandomName

func RandomName() string

RandomName generates a random name for a function, variaable, etc.

func RandomUint64

func RandomUint64() uint64

func ReadFile

func ReadFile(path string) string

ReadFile reads a file from the system

func RecursiveFind

func RecursiveFind(root string, pattern string, allowPrefix bool) ([]string, error)

Find files in a directory based on a pattern

func RelativePath

func RelativePath(root string, path string) string

Get the realtive path of a file, relative to some root

func WriteFile

func WriteFile(path string, content string) error

WriteFile and some content to the filesystem

Types

This section is empty.

Jump to

Keyboard shortcuts

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