title: Go find files in directory recursively
body: <p>I want to find all files matching a specific pattern in a directory recursively (including subdirectories). I wrote the code to do this:</p>
  <pre><code>libRegEx, e := regexp.Compile(&quot;^.+\\.(dylib)$&quot;)
  if e != nil {
      log.Fatal(e)
  }
  
  files, err := ioutil.ReadDir(&quot;/usr/lib&quot;)
  if err != nil {
      log.Fatal(err)
  }
  
  for _, f := range files {
      if libRegEx.MatchString(f.Name()) {
          println(f.Name())
      }
  }
  </code></pre>
  <p>Unfortunately, it only searches in <code>/usr/bin</code>, but I also want to search for matches in its subdirectories. How can I achieve this? Thanks.</p>