Documentation ¶
Overview ¶
Package util contains a collection of miscellaneous utility functions.
Index ¶
- func Basename(p string) string
- func BoolMapTrue(l []bool) bool
- func BoolMapValues(m map[string]bool) []bool
- func DirifyFileList(fileList []string, removeDirs bool) []string
- func Dirname(p string) string
- func FirstToUpper(str string) string
- func FlattenListWithSplit(input []string, split []string) []string
- func HasPathPrefix(p, prefix string) bool
- func PathPrefixDelta(p, prefix string) int
- func PathSplit(p string) []string
- func PathSplitFullReversed(p string) []string
- func RemoveCommonFilePrefixes(paths []string) []string
- func ReverseStringList(in []string) []string
- func StrFilterElementsInList(filter []string, list []string) []string
- func StrInList(needle string, haystack []string) bool
- func StrInPathPrefixList(needle string, haystack []string) bool
- func StrListIntersection(list1 []string, list2 []string) []string
- func StrMapKeys(m map[string]string) []string
- func StrMapKeysUint64(m map[string]uint64) []string
- func StrMapValues(m map[string]string) []string
- func StrMapValuesUint64(m map[uint64]string) []string
- func StrRemoveDuplicatesInList(list []string) []string
- func SystemBusPrivateUsable() (conn *dbus.Conn, err error)
- func TimeAfterOrBlock(t int) <-chan time.Time
- func Uint64KeyFromStrInMap(needle string, haystack map[uint64]string) (uint64, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolMapTrue ¶
BoolMapTrue returns true if everyone in the list is true.
func BoolMapValues ¶
BoolMapValues returns the sorted list of bool values in a map with string values.
func DirifyFileList ¶
DirifyFileList adds trailing slashes to any likely dirs in a package manager fileList if removeDirs is true, otherwise, don't keep the dirs in our output.
func FirstToUpper ¶
FirstToUpper returns the string with the first character capitalized.
func FlattenListWithSplit ¶
FlattenListWithSplit flattens a list of input by splitting each element by any and all of the strings listed in the split array
func HasPathPrefix ¶
HasPathPrefix tells us if a path string contain the given path prefix in it.
func PathPrefixDelta ¶
PathPrefixDelta returns the delta of the path prefix, which tells you how many path tokens different the prefix is.
func PathSplit ¶
PathSplit splits a path into an array of tokens excluding any trailing empty tokens.
func PathSplitFullReversed ¶
PathSplitFullReversed returns the full list of "dependency" paths for a given path in reverse order.
func RemoveCommonFilePrefixes ¶
RemoveCommonFilePrefixes removes redundant file path prefixes that are under the tree of other files.
func ReverseStringList ¶
ReverseStringList reverses a list of strings.
func StrFilterElementsInList ¶
StrFilterElementsInList removes any of the elements in filter, if they exist in the list.
func StrInPathPrefixList ¶
StrInPathPrefixList returns true if the needle is a PathPrefix in the haystack.
func StrListIntersection ¶
StrListIntersection removes any of the elements in filter, if they don't exist in the list. This is an in order intersection of two lists.
func StrMapKeys ¶
StrMapKeys return the sorted list of string keys in a map with string keys. NOTE: i thought it would be nice for this to use: map[string]interface{} but it turns out that's not allowed. I know we don't have generics, but come on!
func StrMapKeysUint64 ¶
StrMapKeysUint64 return the sorted list of string keys in a map with string keys but uint64 values.
func StrMapValues ¶
StrMapValues returns the sorted list of string values in a map with string values.
func StrMapValuesUint64 ¶
StrMapValuesUint64 return the sorted list of string values in a map with string values.
func StrRemoveDuplicatesInList ¶
StrRemoveDuplicatesInList removes any duplicate values in the list. This is a possibly sub-optimal, O(n^2)? implementation.
func SystemBusPrivateUsable ¶
SystemBusPrivateUsable makes using the private bus usable TODO: should be upstream: https://github.com/godbus/dbus/issues/15
func TimeAfterOrBlock ¶
TimeAfterOrBlock is aspecial version of time.After that blocks when given a negative integer. When used in a case statement, the timer restarts on each select call to it.
Types ¶
This section is empty.