title: How does channel blocking work in Go?
body: <p>I'm learning the Go language. Here is an example I've come across. Can someone please explain what is happening here?</p>
  
  <pre><code>package main
  import "time"
  import "fmt"
  func main() {
      c1 := make(chan string)
      c2 := make(chan string)
      go func() {
          time.Sleep(time.Second * 1)
          c1 &lt;- "one"
      }()
      go func() {
          time.Sleep(time.Second * 2)
          c2 &lt;- "two"
      }()
      for i := 0; i &lt; 2; i++ {
        select {
          case msg1 := &lt;-c1:
            fmt.Println("received", msg1)
          case msg2 := &lt;-c2:
            fmt.Println("received", msg2)
          default:
            fmt.Println("Default")
        }
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Default
  Default
  Program Exited
  </code></pre>
  
  <p>If I comment out the default section</p>
  
  <pre><code>//default:
  //    fmt.Println("Default")
  </code></pre>
  
  <p>the output becomes:</p>
  
  <pre><code>received one
  received two
  Program exited.
  </code></pre>
  
  <p>How does the presence of the <code>default</code> case change the way channel blocking works?</p>