title: How to get the directory of the currently running file?
body: <p>In nodejs I use <a href="http://nodejs.org/api/globals.html#globals_dirname">__dirname</a> . What is the equivalent of this in Golang?</p>
  
  <p>I have googled and found out this article <a href="http://andrewbrookins.com/tech/golang-get-directory-of-the-current-file/">http://andrewbrookins.com/tech/golang-get-directory-of-the-current-file/</a> . Where he uses below code</p>
  
  <pre><code>_, filename, _, _ := runtime.Caller(1)
  f, err := os.Open(path.Join(path.Dir(filename), "data.csv"))
  </code></pre>
  
  <p>But is it the right way or idiomatic way to do in Golang?</p>