Discover Packages
github.com/getstackit/stackit
internal
workpool
package
Version:
v0.30.1
Opens a new window with list of versions in this module.
Published: Oct 30, 2026
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package workpool runs work over a slice on a bounded pool of goroutines.
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.
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[T any ](items []T, numWorkers int , worker func(item T))
RunN is Run with an explicit worker count; numWorkers <= 0 means GOMAXPROCS.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.