You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What does 'go version' print?
go version go1.3 darwin/amd64
What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
template.ParseFiles("tmpl/view.html", "view.html")
"html/template"'s package ParseFiles function will attempt to associate both
files with the same name "view.html". Both files are different contents,
different paths, they should both be available for later execution
See: http://play.golang.org/p/3ZTfkfbYlm
What happened?
The program panics. I am not able to define different templates with the same file name,
even if they are in completely different locations
See: http://play.golang.org/p/3ZTfkfbYlm
What should have happened instead?
Both files should be available, no panics
Please provide any additional information below.
If no one is assigned yet, I would be glad to make a fix :)
The text was updated successfully, but these errors were encountered:
I think this is working as intended. The definition of ParseFiles says that the
template is named for the base name of the first file. If you want to be able to handle
multiple templates with the same base name, don't use ParseFiles. I don't see how we
can change this behaviour without breaking the backward compatibility guarantee.
I see. I wish there was such a convenience function like ParseFiles but for my case.
I am not 100% sure yet but are you suggesting AddParseTree should be used in this case?
by nacho4d:
The text was updated successfully, but these errors were encountered: