utils

package
v0.0.0-...-f6a3884 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunkify

func Chunkify(items []string, count int) [][]string

chunkify a count of processors across sockets

func CopyFile

func CopyFile(src, dest string) error

CopyFile copies a source to a destination and ensures the parent directory exists

func FullPath

func FullPath(path string) (string, error)

FullPath gets a full executable path, and makes it absolute

func GetJsonUrl

func GetJsonUrl(url string, target any) error

GetJsonUrl gets json from a url and decodes into target interface

func LookupValue

func LookupValue(
	p map[string]string,
	keys ...string,
) (string, error)

lookup a value, return error if not defined for either

func ParseConfigFile

func ParseConfigFile(path, comment, delim string) (map[string]string, error)

ParseConfigFile parses a simple configuration file, with newlines for each thing, and a starting prefix to determine comma, and some other delimiter to determine key value pairs

func PathExists

func PathExists(path string) (bool, error)

PathExists determines if a path exists

func RandomSort

func RandomSort(items []string) []string

RandomSort an array of strings, in place

func RunCommand

func RunCommand(args []string) (string, error)

RunCommand runs an executable (name)

func SplitDelimiterList

func SplitDelimiterList(items []string, delim string) (map[string]string, error)

SplitDelimiterList splits a list of items by an additional delimiter

func StringArrayIsSubset

func StringArrayIsSubset(contenders, items []string) ([]string, bool)

ArrayContainsString determines if a string is in an array We return an array of invalid names in case the calling function needs

Types

This section is empty.

Jump to

Keyboard shortcuts

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