aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.go/chan.go
blob: f2372880686cca49cbab1beb103725240739c72c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import "fmt"

func generate() chan int {
    ch := make(chan int)
    go func() {
        for i := 0; ; i++ {
            ch <- i // set breakpoint 1 here
        }
    }()
    return ch
}

func main() {
    integers := generate()
    for i := 0; i < 100; i++ { // Print the first hundred integers.
        fmt.Println(<-integers) // set breakpoint 2 here
    }
}