title: How to get the directory of the package the file is in, not the current working directory
body: <p>I'm making a package to make API calls to a service.</p>
  
  <p>I have a test package that I use just to test the API calls and test the functions of the main package which I just <code>include</code> the other package into.</p>
  
  <p>In my main package that I'm working on I have </p>
  
  <p><code>ioutil.ReadFile(filepath.Abs("Filename.pub"))</code></p>
  
  <p>Which is ok, but when I call it from my test package e.g.</p>
  
  <p><code>/Users/####/gocode/src/github.com/testfolder go run main.go</code></p>
  
  <p>it tells me </p>
  
  <p><code>panic: open /Users/####/gocode/src/github.com/testfolder/public.pub: no such file or directory</code></p>
  
  <p>The problem is, is it is looking for <code>public.pub</code> inside of <code>testfolder</code> instead of <code>github.com/apipackage/</code> which is where it is.</p>
  
  <p>Just to clarify this mess of words:</p>
  
  <p>The API Package has a function that reads from the same directory</p>
  
  <p>But because I'm including the API package and Testfolder is the CWD when I <code>go run main.go</code> it is instead trying to get it from the <code>testfolder</code> instead even though the main.go doesn't have the function and is just including it.</p>