errgroup: fix build errors in errgroup_test
Change-Id: Ie5ebfa26b6234f833139784da859d32cc1416b26 Reviewed-on: https://go-review.googlesource.com/24961 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
457c582840
commit
53cf14c8d7
1 changed files with 2 additions and 2 deletions
|
|
@ -43,7 +43,7 @@ func ExampleGroup_justErrors() {
|
||||||
for _, url := range urls {
|
for _, url := range urls {
|
||||||
// Launch a goroutine to fetch the URL.
|
// Launch a goroutine to fetch the URL.
|
||||||
url := url // https://golang.org/doc/faq#closures_and_goroutines
|
url := url // https://golang.org/doc/faq#closures_and_goroutines
|
||||||
g.Go(func(url string) error {
|
g.Go(func() error {
|
||||||
// Fetch the URL.
|
// Fetch the URL.
|
||||||
resp, err := http.Get(url)
|
resp, err := http.Get(url)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
@ -53,7 +53,7 @@ func ExampleGroup_justErrors() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// Wait for all HTTP fetches to complete.
|
// Wait for all HTTP fetches to complete.
|
||||||
if err := wg.Wait(); err == nil {
|
if err := g.Wait(); err == nil {
|
||||||
fmt.Println("Successfully fetched all URLs.")
|
fmt.Println("Successfully fetched all URLs.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue