title: How to pass a variable in a Golang callback function?
body: <p>I have the following code:</p>
  
  <pre><code>func loopThroughDirs(path string, fileInfo os.FileInfo, err error) error {
      ...do something with service...
      return nil
  }
  
  func main() {
      service, err := storage.New(client)
      ...
      filepath.Walk(*dirName, loopThroughDirs)
  }
  </code></pre>
  
  <p>The problem I want to solve is this, I want to use <code>service</code> <em>inside</em> <code>loopThroughDirs()</code>. How do I do this?</p>
  
  <p>PS:
  Is the <code>loopThroughDirs</code> function inside <code>filepath.Walk()</code> called a callback in Go?</p>