tutorial: replace the forever loops with finite counts in sieve programs.
Fixes #1742.
I hope.
Also this picks up an update to go_tutorial.html that should already have happened.
R=brainman, rsc, peterGo
CC=golang-dev
https://golang.org/cl/4452050
diff --git a/doc/progs/sieve.go b/doc/progs/sieve.go
index fb649e0..c7c3e78 100644
--- a/doc/progs/sieve.go
+++ b/doc/progs/sieve.go
@@ -28,7 +28,7 @@
func main() {
ch := make(chan int) // Create a new channel.
go generate(ch) // Start generate() as a goroutine.
- for {
+ for i := 0; i < 100; i++ { // Print the first hundred primes.
prime := <-ch
fmt.Println(prime)
ch1 := make(chan int)
diff --git a/doc/progs/sieve1.go b/doc/progs/sieve1.go
index 71468d0..e785e20 100644
--- a/doc/progs/sieve1.go
+++ b/doc/progs/sieve1.go
@@ -45,7 +45,7 @@
func main() {
primes := sieve()
- for {
+ for i := 0; i < 100; i++ { // Print the first hundred primes.
fmt.Println(<-primes)
}
}