An open API service indexing awesome lists of open source software.

https://github.com/pdube/nike

Simple parallel job runner
https://github.com/pdube/nike

golang parallel

Last synced: about 2 months ago
JSON representation

Simple parallel job runner

Awesome Lists containing this project

README

          

# nike

`nike` is a simple library to run functions in parallel and return the accumulated errors, if any. It will create as many workers as there are CPUs at runtime. It is named after the ancient greek goddess of victory [Nike](https://en.wikipedia.org/wiki/Nike_(mythology))

## Usage example

```golang
package main

import "github.com/pdube/nike"

func main() {
fns := []func() error {
func() error {
//do something here
time.Sleep(time.Millisecond * 500)
return fmt.Errorf("uninmplemented yet #1")
},
func() error {
//do something here
return fmt.Errorf("uninmplemented yet #2")
},
}

errs := nike.JustDoIt(fns)
if len(errs) > 0 {
for i := range errs {
fmt.Println(errs[i])
}
}
}
```