summaryrefslogtreecommitdiff
path: root/test/sieve.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-01-16 16:12:14 -0800
committerRuss Cox <rsc@golang.org>2009-01-16 16:12:14 -0800
commit976529fd654f2cdf6ca21afcdeddedeff7d9583a (patch)
tree7da3dc3316609873715c3e6e7871cb2bf57da081 /test/sieve.go
parentdbfbdc283ac50455e365a40912828137e215ebde (diff)
downloadgo-976529fd654f2cdf6ca21afcdeddedeff7d9583a.tar.gz
convert tests; nothing interesting.
R=r OCL=23012 CL=23014
Diffstat (limited to 'test/sieve.go')
-rw-r--r--test/sieve.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/sieve.go b/test/sieve.go
index e16345617..f6a07277f 100644
--- a/test/sieve.go
+++ b/test/sieve.go
@@ -7,7 +7,7 @@
package main
// Send the sequence 2, 3, 4, ... to channel 'ch'.
-func Generate(ch chan<- int) {
+export func Generate(ch chan<- int) {
for i := 2; ; i++ {
ch <- i // Send 'i' to channel 'ch'.
}
@@ -15,7 +15,7 @@ func Generate(ch chan<- int) {
// Copy the values from channel 'in' to channel 'out',
// removing those divisible by 'prime'.
-func Filter(in <-chan int, out chan<- int, prime int) {
+export 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 {
@@ -25,7 +25,7 @@ func Filter(in <-chan int, out chan<- int, prime int) {
}
// The prime sieve: Daisy-chain Filter processes together.
-func Sieve() {
+export func Sieve() {
ch := make(chan int); // Create a new channel.
go Generate(ch); // Start Generate() as a subprocess.
for {