Help us shape the future of Go! Take the 2026 Go Developer Survey

workpool

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package workpool runs work over a slice on a bounded pool of goroutines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run[T any](items []T, worker func(item T))

Run runs the given worker function for each item in the slice in parallel. It uses runtime.GOMAXPROCS(0) as the default number of workers.

func RunAll

func RunAll[T any](items []T, numWorkers int, worker func(item T) error) error

RunAll runs worker for each item on a pool of numWorkers goroutines (0 means GOMAXPROCS) and returns every worker error joined. A failing item does not stop the others, so callers see all failures, not just the first. With one worker, items run in slice order.

func RunN

func RunN[T any](items []T, numWorkers int, worker func(item T))

RunN is Run with an explicit worker count; numWorkers <= 0 means GOMAXPROCS.

Types

This section is empty.

Jump to

Keyboard shortcuts

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