title: Break out of select loop?
body: <p>I'm trying to use a <code>select</code> in a loop to receive either a message or a timeout signal. If the timeout signal is received, the loop should abort:</p>
  
  <pre><code>package main
  import ("fmt"; "time")
  func main() {
      done := time.After(1*time.Millisecond)
      numbers := make(chan int)
      go func() {for n:=0;; {numbers &lt;- n; n++}}()
      for {
          select {
              case &lt;-done:
                  break
              case num := &lt;- numbers:
                  fmt.Println(num)
          }
      }
  }
  </code></pre>
  
  <p>However, it doesn't seem to be stopping:</p>
  
  <pre><code>$ go run a.go
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  [...]
  3824
  3825
  [...]
  </code></pre>
  
  <p>Why? Am I using <code>time.After</code> wrong?</p>