Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
text/template: Better doc for ParseFiles and Execute behaviour. #11247
I recently spent some time trying to figure why a template with Funcmaps would work with Parse() but not with ParseFiles() when using Execute (instead of ExecuteTemplate with the name).
I found the answer in Stack Overflow http://stackoverflow.com/questions/10199219/go-template-function but the question also appeared in golang-nuts, for example here https://groups.google.com/forum/#!topic/golang-nuts/CI9WdC_sk00 and here https://groups.google.com/forum/#!topic/golang-nuts/vmZHHfLsH8M
Please consider if it should be better documented to make it less error-prone for inexperienced users.
I came here because I also wanted to open an issue about this. This API is not really developer friendly. Maybe one should change the semantics too and not only the docs. It feels wrong to name the most outer template again in template new just to add a funcMap via .Funcs.
One has to explicitly name the outer template. This should at least be documented :)