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: (also html/template?) document Execute can write to writer before returning an error #7445

sidnei opened this issue Mar 3, 2014 · 7 comments


Copy link

@sidnei sidnei commented Mar 3, 2014

What steps will reproduce the problem?
If possible, include a link to a program on
1. create a template with multiple sub-templates (if i got the terminology right)
2. .Execute() it with a writer

What is the expected output?
If .Execute() returns an error, the expectation is that no output is written.

What do you see instead?
Depending on how the template is constructed, .Execute() may cause some data to be
written before the error is returned. 

It should be documented that if you require no output to be written in the case of an
error, then you should necessarily write out to a temporary buffer and check the error
first, and then copy the buffer to it's final destination.

Please provide any additional information below.
Copy link

@bradfitz bradfitz commented Mar 3, 2014

Comment 1:

Pretty sure this is WAI but assigning to Rob to decide.

Owner changed to @robpike.

Copy link

@robpike robpike commented Mar 3, 2014

Comment 2:

Yes, the code is working as intended - otherwise the package could require an unbounded
amount of buffering - but perhaps the documentation should say something about the topic.

Labels changed: added release-go1.3maybe, repo-main.

Status changed to Accepted.

Copy link

@rsc rsc commented May 11, 2014

Comment 3:

Labels changed: added documentation.

Copy link

@robpike robpike commented May 19, 2014

Comment 4:

Labels changed: added release-go1.4maybe, removed release-go1.3maybe.

Copy link

@robpike robpike commented May 19, 2014

Comment 5:

Labels changed: added release-go1.3, removed release-go1.4maybe.

Copy link

@gopherbot gopherbot commented May 19, 2014

Comment 6:

CL mentions this issue.
Copy link

@robpike robpike commented May 19, 2014

Comment 7:

This issue was closed by revision 431b96b.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.