errgroup: fix misleading comment in MD5All example
Change-Id: I0c2f0ce9b6006dac13c5f5faed752a2475992805 Reviewed-on: https://go-review.googlesource.com/33851 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
1ae7c7b29e
commit
81567d9de7
1 changed files with 3 additions and 3 deletions
|
|
@ -39,9 +39,9 @@ type result struct {
|
||||||
// from file path to the MD5 sum of the file's contents. If the directory walk
|
// from file path to the MD5 sum of the file's contents. If the directory walk
|
||||||
// fails or any read operation fails, MD5All returns an error.
|
// fails or any read operation fails, MD5All returns an error.
|
||||||
func MD5All(ctx context.Context, root string) (map[string][md5.Size]byte, error) {
|
func MD5All(ctx context.Context, root string) (map[string][md5.Size]byte, error) {
|
||||||
// ctx is canceled when MD5All calls g.Wait(). When this version of MD5All
|
// ctx is canceled when g.Wait() returns. When this version of MD5All returns
|
||||||
// returns - even in case of error! - we know that all of the goroutines have
|
// - even in case of error! - we know that all of the goroutines have finished
|
||||||
// finished and the memory they were using can be garbage-collected.
|
// and the memory they were using can be garbage-collected.
|
||||||
g, ctx := errgroup.WithContext(ctx)
|
g, ctx := errgroup.WithContext(ctx)
|
||||||
paths := make(chan string)
|
paths := make(chan string)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue