Loading a needed file, relative vs absolute paths
We have a program people can compile on their machines. It has an HTTP interface but can also be invoked by command line. In order to provide some nice-looking error pages for HTTP clients, we want to provide error pages. We are using a very simple solution with go's html/template package. So in order for the program to find the templates, we currently do: func init() { prefStr := "path/to/http/tmpl" pathPrefix,err := filepath.Abs(prefStr) if err != nil { log.Warn("Template path %s is not available!", prefStr) } pathPrefix + "/err.html" } Now when debugging the app, this usually works well - w
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.