title: Two routines communicating on the same channel
body: <p>I have a function that, given a slice and an array, will send the elements of the slice to the channel one by one</p>
  
  <p><a href="http://play.golang.org/p/Ydl2e_h4pp" rel="nofollow">Link to playground</a></p>
  
  <pre><code>package main
  
  import (
      "fmt"
  )
  
  var list1 = []string{"1", "2", "4"}
  
  var list2 = []string{"11", "22", "44"}
  
  func throw(ch chan string, list []string) {
      for _, el := range list {
          fmt.Println("Thrown ", el)
          ch &lt;- el
  
      }
      close(ch)
      return
  }
  
  func main() {
      c := make(chan string)
      go throw(c, list1)
      go throw(c, list2)
      for i := range c {
          fmt.Println("received ", i)
      }
  }
  </code></pre>
  
  <p>At some point the channel get closed, but one of the functions still needs to send data to it. How should I handle this? Making to separate channel seems the most reasonable choice here, but I want both data to pass through the same channel.</p>