title: Channels/Goroutines throwing error
body: <p>I'm currently following this tutorial <a href="http://www.miek.nl/files/go/20120807-go.pdf" rel="nofollow">http://www.miek.nl/files/go/20120807-go.pdf</a> and on chapter 7 it discusses channels/goroutines</p>
  
  <p>However the example code is throwing an error for me just after you run it.</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "time"
  )
  
  var c chan int
  
  func ready(w string, sec int) {
      time.Sleep(time.Duration(sec) * time.Second)
      fmt.Println(w, "is ready!")
      c &lt;- 1
  }
  
  func main() {
      c := make(chan int)
      go ready("Tea", 2)
      go ready("Coffee", 1)
      fmt.Println("Waiting...")
      &lt;-c
      &lt;-c
  }
  </code></pre>
  
  <p>Here is the output when you execute the code</p>
  
  <pre><code>daniel:go&gt; go run goroutines.go 
  Waiting...
  Coffee is ready!
  Tea is ready!
  throw: all goroutines are asleep - deadlock!
  
  goroutine 1 [chan receive]:
  main.main()
      /home/daniel/Dropbox/code/go/goroutines.go:21 +0xee
  
  goroutine 2 [syscall]:
  created by runtime.main
      /build/buildd/golang-1/src/pkg/runtime/proc.c:221
  
  goroutine 3 [chan send (nil chan)]:
  main.ready(0x80bb0d4, 0x3, 0x2, 0x0)
      /home/daniel/Dropbox/code/go/goroutines.go:13 +0xe5
  created by main.main
      /home/daniel/Dropbox/code/go/goroutines.go:18 +0x5e
  
  goroutine 4 [chan send (nil chan)]:
  main.ready(0x80bba30, 0x6, 0x1, 0x0)
      /home/daniel/Dropbox/code/go/goroutines.go:13 +0xe5
  created by main.main
      /home/daniel/Dropbox/code/go/goroutines.go:19 +0x80
  
  goroutine 5 [timer goroutine (idle)]:
  created by addtimer
      /build/buildd/golang-1/src/pkg/runtime/ztime_386.c:69
  exit status 2
  </code></pre>
  
  <p>Is there something wrong with my code? </p>
  
  <p>Any help would be appreciated</p>