Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text/template: improve error message about empty/incomplete templates after Funcs() #4522

Closed
kylelemons opened this issue Dec 11, 2012 · 2 comments
Milestone

Comments

@kylelemons
Copy link
Contributor

The error message is here:
http://golang.org/src/pkg/text/template/exec.go#L115

I've noticed that this has caused problems for people both on the mailing list and on
IRC.  This often comes up with respect to template.Funcs, where you suddenly have to
create an empty template before you can attach functions to it.

Possible improvements:
- say "did you mean to call ExecuteTemplate?"
- include a list of complete templates that do exist in the template set
- provide a top-level Funcs() function that returns a template on which ParseFiles has
its top-level effect of causing the first template to be selected on Execute
- explain a bit more what's going on in the documentation for the functions above, and
add examples
@rsc
Copy link
Contributor

rsc commented Dec 30, 2012

Comment 1:

Labels changed: added priority-later, removed priority-triage.

Status changed to Thinking.

@robpike
Copy link
Contributor

robpike commented Mar 6, 2013

Comment 2:

This issue was closed by revision c763799.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants