Commit a64e6322 authored by Rob Pike's avatar Rob Pike

faq: fix minor errors in programs reported by Wojciech Mikanik

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4114041
parent bba20fc1
......@@ -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:
<pre>
for _, v := range values {
go func(<b>u</b>) {
go func(<b>u</b> string) {
fmt.Println(<b>u</b>)
done &lt;- true
}(<b>v</b>)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment