aboutsummaryrefslogtreecommitdiff
path: root/test/sieve.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-06-27 11:36:40 -0700
committerRob Pike <r@golang.org>2008-06-27 11:36:40 -0700
commitf977e251fa3f782ad640889bbe72336af83399dd (patch)
tree8791f9c2b2fb19a5b4b5ea75c9803e5ea5bec463 /test/sieve.go
parent1f672596c5103e769a803afa01e1eb3ccb1e7edc (diff)
downloadgo-f977e251fa3f782ad640889bbe72336af83399dd.tar.gz
go-f977e251fa3f782ad640889bbe72336af83399dd.zip
add a test
fix make.bash for runtime - sysfile.6 depends on OS so simplest thing is to build just our own version SVN=125130
Diffstat (limited to 'test/sieve.go')
-rw-r--r--test/sieve.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/sieve.go b/test/sieve.go
index c27519ab9d..dd23903e16 100644
--- a/test/sieve.go
+++ b/test/sieve.go
@@ -9,7 +9,7 @@ package Main
// Send the sequence 2, 3, 4, ... to channel 'ch'.
func Generate(ch *chan> int) {
for i := 2; ; i++ {
- >ch = i; // Send 'i' to channel 'ch'.
+ >ch = i // Send 'i' to channel 'ch'.
}
}
@@ -17,9 +17,9 @@ func Generate(ch *chan> int) {
// removing those divisible by 'prime'.
func Filter(in *chan< int, out *chan> int, prime int) {
for {
- i := <in; // Receive value of new variable 'i' from 'in'.
+ 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'.
}
}
}
@@ -33,10 +33,10 @@ func Sieve() {
print "%d\n", prime;
ch1 := new(chan int);
go Filter(ch, ch1, prime);
- ch = ch1;
+ ch = ch1
}
}
func Main() {
- Sieve();
+ Sieve()
}