{"modulePath":"github.com/taskcluster/taskcluster-worker","version":"v0.1.20","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package util\n\nPackage util contains a few simple utilites that has no internal dependencies. This is to encourage reuse of code.\n\n## Functions\n\n```go\nfunc Debug(name string) func(string, ...interface{})\n```\nDebug will return a debug(format, arg, arg...) function for which messages will be printed if the DEBUG environment variable is set.\n\nThis is useful for development debugging only. Do not use this for messages that has any value in production.\n\n```go\nfunc Download(url, destdir string) (string, error)\n```\nDownload downloads the request file in the url\n\n```go\nfunc Markdown(s string) string\n```\nMarkdown strips space indentation and replaces ' with \\`, allowing for markdown to be written as indended multi-line strings.\n\n```go\nfunc Parallel(f ...func())\n```\nParallel takes a list of functions and calls them all in concurrently, returning when all the functions are done.\n\nThis doesn't have any nice error or panic handling and is aimed as construct to be used inside other functions, mainly to reduce boiler-plate.\n\n```go\nfunc Spawn(N int, fn func(i int))\n```\nSpawn N go routines and wait for them to return.\n\nThis utility is smart when instantiating elements in an array concurrently.\n\n```go\nfunc SpawnWithLimit(N, limit int, fn func(i int))\n```\nSpawnWithLimit N go routines running at-most limit in parallel and wait for them to return.\n\nThis utility is smart when instantiating elements in an array concurrently.\n\n## Types\n\n```go\ntype StringList []string\n```\nStringList is a list of strings and useful methods\n\n```go\nfunc (s *StringList) Add(values ...string)\n```\nAdd a list of strings\n\n```go\nfunc (s *StringList) Contains(value string) bool\n```\nContains returns true if s contains value\n\n```go\nfunc (s *StringList) Join(sep string) string\n```\nJoin concatenates elements fo the list with given separator\n\n```go\nfunc (s *StringList) Sprint(a ...interface{})\n```\nSprint adds a string using fmt.Sprint syntax\n\n```go\nfunc (s *StringList) Sprintf(format string, a ...interface{})\n```\nSprintf adds a string using fmt.Sprintf syntax\n\n","path":"github.com/taskcluster/taskcluster-worker/runtime/util","name":"util","synopsis":"Package util contains a few simple utilites that has no internal dependencies.","isRedistributable":true}
