title: Specifying template filenames for template.ParseFiles
body: <p>My current directory structure looks like the following:</p>
  
  <pre><code>App
    - Template
      - foo.go
      - foo.tmpl
    - Model
      - bar.go
    - Another
      - Directory
        - baz.go
  </code></pre>
  
  <p>The file <code>foo.go</code> uses <code>ParseFiles</code> to read in the template file during <code>init</code>. </p>
  
  <pre><code>import "text/template"
  
  var qTemplate *template.Template
  
  func init() {
    qTemplate = template.Must(template.New("temp").ParseFiles("foo.tmpl"))
  }
  
  ...
  </code></pre>
  
  <p>Unit tests for <code>foo.go</code> work as expected. However, I am now trying to run unit tests for <code>bar.go</code> and <code>baz.go</code> which both import <code>foo.go</code> and I get a panic on trying to open <code>foo.tmpl</code>.</p>
  
  <pre><code>/App/Model$ go test    
  panic: open foo.tmpl: no such file or directory
  
  /App/Another/Directory$ go test    
  panic: open foo.tmpl: no such file or directory
  </code></pre>
  
  <p>I've tried specifying the template name as a relative directory ("./foo.tmpl"), a full directory ("~/go/src/github.com/App/Template/foo.tmpl"), an App relative directory ("/App/Template/foo.tmpl"), and others but nothing seems to work for both cases. The unit tests fail for either <code>bar.go</code> or <code>baz.go</code> (or both).</p>
  
  <p>Where should my template file be placed and how should I call <code>ParseFiles</code> so that it can always find the template file regardless of which directory I call <code>go test</code> from? </p>