https://github.com/mitranim/cc
[MOVED] Tiny Go tool for running multiple functions concurrently and collecting their results into an error slice.
https://github.com/mitranim/cc
concurrency golang
Last synced: 6 months ago
JSON representation
[MOVED] Tiny Go tool for running multiple functions concurrently and collecting their results into an error slice.
- Host: GitHub
- URL: https://github.com/mitranim/cc
- Owner: mitranim
- License: unlicense
- Created: 2021-11-07T18:31:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-26T17:19:01.000Z (almost 3 years ago)
- Last Synced: 2025-07-14T13:33:18.061Z (6 months ago)
- Topics: concurrency, golang
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
**Moved to https://github.com/mitranim/gg**. This repo is usable but frozen.
## Overview
Short for "**C**on**C**urrent". Go tool for running multiple functions concurrently, collecting their errors into an error slice. Tiny and dependency-free.
API docs: https://pkg.go.dev/github.com/mitranim/cc.
## Examples
```golang
import "github.com/mitranim/cc"
func ExampleAll() {
err := cc.All(
func() {
fmt.Println(`running in background`)
},
func() {
fmt.Println(`running in background`)
},
)
fmt.Println(`done; no error:`, err == nil)
// Output:
// running in background
// running in background
// done; no error: true
}
func ExampleConc() {
var conc cc.Conc
conc.Add(func() {
fmt.Println(`running in background`)
})
conc.Add(func() {
fmt.Println(`running in background`)
})
fmt.Println(`starting`)
err := conc.All()
fmt.Println(`done; no error:`, err == nil)
// Output:
// starting
// running in background
// running in background
// done; no error: true
}
```
## License
https://unlicense.org
## Misc
I'm receptive to suggestions. If this library _almost_ satisfies you but needs changes, open an issue or chat me up. Contacts: https://mitranim.com/#contacts