blob: cdcdb85f2ec814d6a9f1abfdce6d443b494dd90a [file] [log] [blame]
// +build ignore,OMIT
package main
import (
"fmt"
"time"
)
func f(left, right chan int) {
left <- 1 + <-right
}
func main() {
start := time.Now()
const n = 1000
leftmost := make(chan int)
right := leftmost
left := leftmost
for i := 0; i < n; i++ {
right = make(chan int)
go f(left, right)
left = right
}
go func(c chan int) { c <- 0 }(right)
fmt.Println(<-leftmost, time.Since(start))
}