I have a global constant like this.
const TemplateDir string = "/home/joe/go/src/proj/template/"
Then, later in my code I call this.
template.ParseGlob(filepath.Join(TemplateDir, "*.tmpl"))
I know that filepath.Join(TemplateDir, "*.tmpl")
produces /home/joe/go/src/proj/template/*.tmpl
.
This all compiles fine. However, when I try to run my executable from a directory outside of proj
, I get this error.
html/template: pattern matches no files: `template/*.tmpl`
I'm not sure why I'm getting that error if I passed in an absolute path. Any ideas?
Update
I forgot to mention that I'm calling my program through the $PATH variable. That is, I'm not executing ./proj
anywhere. I'm just calling proj
from my home directory.