From: Rob Pike Date: Wed, 26 Jan 2011 18:41:32 +0000 (-0800) Subject: faq: fix minor errors in programs reported by Wojciech Mikanik X-Git-Tag: weekly.2011-02-01~72 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a64e63227af8d3fbfed2842298e40dcf8152c32f;p=gostls13.git faq: fix minor errors in programs reported by Wojciech Mikanik R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4114041 --- diff --git a/doc/go_faq.html b/doc/go_faq.html index f923a6ae29..3f9c1d246d 100644 --- a/doc/go_faq.html +++ b/doc/go_faq.html @@ -793,7 +793,7 @@ Consider the following program: func main() { done := make(chan bool) - values = []string{ "a", "b", "c" } + values := []string{ "a", "b", "c" } for _, v := range values { go func() { fmt.Println(v) @@ -802,7 +802,7 @@ func main() { } // wait for all goroutines to complete before exiting - for i := range values { + for _ = range values { <-done } } @@ -823,7 +823,7 @@ could modify the inner loop to read:
 	for _, v := range values {
-		go func(u) {
+		go func(u string) {
 			fmt.Println(u)
 			done <- true
 		}(v)