taskcluster-worker: github.com/taskcluster/taskcluster-worker/runtime/util Index | Files

package util

import "github.com/taskcluster/taskcluster-worker/runtime/util"

Package util contains a few simple utilites that has no internal dependencies. This is to encourage reuse of code.


Package Files

debug.go doc.go download.go markdown.go parallel.go stringlist.go

func Debug Uses

func Debug(name string) func(string, ...interface{})

Debug will return a debug(format, arg, arg...) function for which messages will be printed if the DEBUG environment variable is set.

This is useful for development debugging only. Do not use this for messages that has any value in production.

func Download Uses

func Download(url, destdir string) (string, error)

Download downloads the request file in the url

func Markdown Uses

func Markdown(s string) string

Markdown strips space indentation and replaces ' with `, allowing for markdown to be written as indended multi-line strings.

func Parallel Uses

func Parallel(f ...func())

Parallel takes a list of functions and calls them all in concurrently, returning when all the functions are done.

This 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.

func Spawn Uses

func Spawn(N int, fn func(i int))

Spawn N go routines and wait for them to return.

This utility is smart when instantiating elements in an array concurrently.

func SpawnWithLimit Uses

func SpawnWithLimit(N, limit int, fn func(i int))

SpawnWithLimit N go routines running at-most limit in parallel and wait for them to return.

This utility is smart when instantiating elements in an array concurrently.

type StringList Uses

type StringList []string

StringList is a list of strings and useful methods

func (*StringList) Add Uses

func (s *StringList) Add(values ...string)

Add a list of strings

func (*StringList) Contains Uses

func (s *StringList) Contains(value string) bool

Contains returns true if s contains value

func (*StringList) Join Uses

func (s *StringList) Join(sep string) string

Join concatenates elements fo the list with given separator

func (*StringList) Sprint Uses

func (s *StringList) Sprint(a ...interface{})

Sprint adds a string using fmt.Sprint syntax

func (*StringList) Sprintf Uses

func (s *StringList) Sprintf(format string, a ...interface{})

Sprintf adds a string using fmt.Sprintf syntax

Package util imports 13 packages (graph) and is imported by 45 packages. Updated 2018-05-10. Refresh now. Tools for package owners.