title: Why does this select always run the default case when the first case actually is executed?
body: <p>I'm trying to get a better understanding of golang channels. While reading <a href="http://www.jtolds.com/writing/2016/03/go-channels-are-bad-and-you-should-feel-bad/" rel="noreferrer">this article</a> I'm toying with non-blocking sends and have come up with the following code:</p>
  
  <pre><code>package main
  import (
      "fmt"
      "time"
  )
  
  func main() {
      stuff := make(chan int)
      go func(){
          for i := 0; i &lt; 5; i ++{
              select {
              case stuff &lt;- i:
                  fmt.Printf("Sent %v\n", i)
              default:
                  fmt.Printf("Default on %v\n", i)
              }
          }
          println("Closing")
          close(stuff)
      }()
      time.Sleep(time.Second)
      fmt.Println(&lt;-stuff)
      fmt.Println(&lt;-stuff)
      fmt.Println(&lt;-stuff)
      fmt.Println(&lt;-stuff)
      fmt.Println(&lt;-stuff)
  }
  </code></pre>
  
  <p>This will print:</p>
  
  <pre><code>Default on 0
  Default on 1
  Default on 2
  Default on 3
  Default on 4
  Closing
  0
  0
  0
  0
  0
  </code></pre>
  
  <p>While I do understand that only <code>0</code>s will get printed I do not really understand why the first send does still trigger the <code>default</code> branch of the select?</p>
  
  <p>What is the logic behind the behavior of a select in this case?</p>
  
  <p><a href="https://play.golang.org/p/t7O0T45Y-Z" rel="noreferrer">Example at the Go Playground</a></p>