title: Read file from relative path with different callers
body: <p>I'm trying to read from a file in my project's directory.</p>
  
  <p>My problem is, that depending on the caller, the path changes. The caller changes, because I want to unit test this code and the caller is not <code>Main.go</code> anymore.</p>
  
  <p>This is what my project structure looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/uO9Kx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uO9Kx.png" alt="Project Structure"></a></p>
  
  <p>The code where I try to access <code>specialChars.txt</code> from looks like this:</p>
  
  <pre><code>func RemoveSpecialChars(word string) string {
      file, err := ioutil.ReadFile("wordlists/specialChars.txt")
      [...]
  }
  </code></pre>
  
  <p>This code works for the start from <code>Main.go</code> but not for the start from <code>CleanupUtil_test.go</code>. To get it working from the test I would need <code>file, err := ioutil.ReadFile("../wordlists/specialChars.txt")</code></p>
  
  <p>I found answers like this one: <a href="https://stackoverflow.com/a/32163888/2837489">https://stackoverflow.com/a/32163888/2837489</a>
  <code>_, filename, _, ok := runtime.Caller(0)</code> which is obviously also dependent on the caller.</p>
  
  <p>Is it possible to get the projects root path independent of the calling function?
  Or is my code design wrong? Should I pass the file path into the function?</p>