diff options
author | Rob Pike <r@golang.org> | 2008-09-16 19:33:40 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2008-09-16 19:33:40 -0700 |
commit | 42a99047caf2db7cfaf4901ec69e5dcd17d76b76 (patch) | |
tree | ab6e43e2d90bb66c01882b5a0ece4bdc6607fe94 /test/sieve.go | |
parent | 6a60b18798838c9ca2e0a4da34d6977f9dffe30d (diff) | |
download | golang-42a99047caf2db7cfaf4901ec69e5dcd17d76b76.tar.gz |
update tests to new communications syntax
powser1.go has not been tested - waiting for compiler to catch up
R=ken
OCL=15415
CL=15415
Diffstat (limited to 'test/sieve.go')
-rw-r--r-- | test/sieve.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/sieve.go b/test/sieve.go index 98af979f1..998c4be66 100644 --- a/test/sieve.go +++ b/test/sieve.go @@ -7,19 +7,19 @@ package main // Send the sequence 2, 3, 4, ... to channel 'ch'. -func Generate(ch *chan-< int) { +func Generate(ch *chan<- int) { for i := 2; ; i++ { - ch -< i // Send 'i' to channel 'ch'. + ch <- i // Send 'i' to channel 'ch'. } } // Copy the values from channel 'in' to channel 'out', // removing those divisible by 'prime'. -func Filter(in *chan<- int, out *chan-< int, prime int) { +func Filter(in *<-chan int, out *chan<- int, prime int) { for { i := <-in // Receive value of new variable 'i' from 'in'. if i % prime != 0 { - out -< i // Send 'i' to channel 'out'. + out <- i // Send 'i' to channel 'out'. } } } |