workers

Set up tasks to be executed in parallel.

package main

import (
	"context"
	"log"

	"github.com/bep/workers"
)

func main() {
	// Max 4 tasks to be executed in parallel.
	w := workers.New(4)
	r, _ := w.Start(context.Background())

	r.Run(func() error {
		return nil
	})

	// ... run more tasks.

	if err := r.Wait(); err != nil {
		log.Fatal(err)
	}
}

GitHub

https://github.com/bep/workers