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 | 27c0eb843110e5733a9d7e2b7175c40387d81beb (patch) | |
tree | ab6e43e2d90bb66c01882b5a0ece4bdc6607fe94 /test/sieve.go | |
parent | 47919799b411f0c1e47591887a233d3692bf19b6 (diff) | |
download | go-27c0eb843110e5733a9d7e2b7175c40387d81beb.tar.gz go-27c0eb843110e5733a9d7e2b7175c40387d81beb.zip |
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 98af979f16..998c4be669 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'. } } } |