Documentation ¶
Index ¶
- Constants
- Variables
- func DoConcurrently[T any, errorT any](work func(c chan T, errorChan chan errorT), handleError func(e errorT), ...)
- func FormatTime(t time.Time) string
- func Message(format string, args ...any)
- func Prompt(prompt string) bool
- func RemovePrefix(key string, prefix string) string
- func SortedKeys[T any](m map[string]T) []string
Constants ¶
View Source
const DateFormat = "2006-01-02"
View Source
const TimeFormat = "2006-01-02_15:04:05.000"
View Source
const TimeFormatNoMs = "2006-01-02_15:04:05" // for parsing
Variables ¶
View Source
var TestMessageChannel chan string // If defined, Message writes to this channel
View Source
var TestPromptChannel chan string // If defined, Prompt reads from this channel
Functions ¶
func DoConcurrently ¶
func DoConcurrently[T any, errorT any]( work func(c chan T, errorChan chan errorT), handleError func(e errorT), c chan T, numWorkers int, )
DoConcurrently is a simple worker pool implementation. It starts up numWorkers goroutines and, in each, calls `work(c, errorChan)`. Any errors that `work` writes to errorChan are passed to handleError(). DoConcurrently returns when all the workers have exited.
func FormatTime ¶
func Message ¶
Message prepends the program name and appends a newline to whatever message is passed in, then writes it standard output.
func RemovePrefix ¶
RemovePrefix removes prefix/ from the beginning of a key that is known to start with prefix/.
func SortedKeys ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.