title: Trying to get FIFO processing pipeline using channel
body: <p>I am trying write a sequential processing pipeline in Go using a simple fake example. It traverse a fake directory and run some conversion. So there is a string channel that is shared between them. After a function writes data,  the 2nd function reads it. </p>
  
  <p>Seems to me that it only works and works sequentially too, when i place a go keyword in front of WalkFakeDirectory function as shown in code example below (<a href="https://play.golang.org/p/zIvJ1Vkk7kU" rel="nofollow noreferrer">playground</a>). </p>
  
  <p>Would really appreciate if anyone can explain how this works?</p>
  
  <pre><code>package main 
  import (
  "fmt"
  "strings"
  "sync"
  "time"
  )
  
  func main() {
  
  done := make(chan int)
  path := make(chan string)
  
  defer close(done)
  
  //var wg sync.WaitGroup - Not working too
  //wg.Add(1)
  
  fmt.Println("walking file path")
  
  go WalkFakeDirectoy(done, path)
  
  //wg.Add(1)
  
  ConvertToUpperCase(path, done)
  
  //wg.Wait()
  
  fmt.Println("done!")
  //time.Sleep(2000) // Not working 
  }
  
  func ConvertToUpperCase(files chan string, done chan int) {
  
     for file := range files {
        fmt.Println("converting data data", strings.ToUpper(file))
     }
  }
  
  func WalkFakeDirectoy(done chan int, path chan&lt;- string) {
  
     func() {
      list := []string{"abc", "def", "fgh", "ijk", "mnn"}
  
      for _, file := range list {
          fmt.Println("getting data", file)
          path &lt;- file
          time.Sleep(3000)
        }
     }()
  }
  </code></pre>