Skip to content

Commit

Permalink
README.md: update a use of Collect
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Sep 12, 2024
1 parent 842d881 commit d16f1d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@ of concurrent workers. This can be handled by a solo task, as described above,
and it is a common enough case that the library provides a `Collector` type to
handle it specifically.

To use it, pass a function to `NewCollector` to receive the values:
To use it, pass a function to `Collect` to receive the values:

```go
var sum int
c := taskgroup.NewCollector(func(v int) { sum += v })
c := taskgroup.Collect(func(v int) { sum += v })
```

The `Call`, `Run`, and `Report` methods of `c` wrap a function that yields a
Expand Down

0 comments on commit d16f1d1

Please sign in to comment.