title: Code from GOPL: concurrent web crawler
body: <p>Here is an example code from the book "The Go Programming Language" by Donovan and Kernighan. It's about a simple concurrent web crawler.</p>
  
  <p><a href="https://github.com/adonovan/gopl.io/blob/master/ch8/crawl3/findlinks.go" rel="nofollow noreferrer">https://github.com/adonovan/gopl.io/blob/master/ch8/crawl3/findlinks.go</a></p>
  
  <p>When I put this part (in the <code>main</code> function)</p>
  
  <pre><code>seen := make(map[string]bool)
  for list := range worklist {
      for _, link := range list {
             ....
          }
      }
  }
  </code></pre>
  
  <p>in front of</p>
  
  <pre><code>for i := 0; i &lt; 20; i++ {
      go func() {
          for link := range unseenLinks {
            ...
          }
      }()
  }
  </code></pre>
  
  <p>the code does not work. Why is this?</p>