Parallel execution of functions on Go.
Run the following command from you terminal:
go get github.com/koind/parallel-execPackage usage example.
package main
import (
"fmt"
"errors"
parallel "github.com/koind/parallel-exec"
)
func main() {
fns := make([]func() error, 0, 3)
fns = append(fns, func() error {
fmt.Println("func 1")
return nil
}, func() error {
fmt.Println("func 2")
return errors.New("Hi this error1")
}, func() error {
fmt.Println("func 3")
return nil
})
parallel.Execute(fns, 1, 1)
}The following methods are available:
Execute(funcs []func() error, countParallelExec int, errCount int)Run the following command from you terminal:
go test -v .