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

html/template: panic when applying template to a nil error field #5982

Closed
josharian opened this issue Jul 28, 2013 · 6 comments
Closed

html/template: panic when applying template to a nil error field #5982

josharian opened this issue Jul 28, 2013 · 6 comments
Milestone

Comments

@josharian
Copy link
Contributor

What steps will reproduce the problem?

http://play.golang.org/p/_uvwyBeprp


What is the expected output?

TEXT
<nil>
HTML
<nil>


What do you see instead?

TEXT
<nil>
HTML
panic...


Which version are you using?  (run 'go version')

Reproduced with 1.1, playground, and tip (2fe813f4f3c2)


Please provide any additional information below.

As you can see, this only impacts html/template, not text/template. As far I have seen,
it only occurs with field type error. (Tested: string, int, byte slices.)
@remyoudompheng
Copy link
Contributor

Comment 1:

Please use code snippets that check errors to avoid double work from readers.

@josharian
Copy link
Contributor Author

Comment 2:

Apologies: http://play.golang.org/p/Lb4Zf-jEAp

@josharian
Copy link
Contributor Author

Comment 3:

Or better, using template.Must: http://play.golang.org/p/yho6UKhjNz

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 4:

Labels changed: added priority-later, go1.2maybe, removed priority-triage.

Status changed to Accepted.

@josharian
Copy link
Contributor Author

Comment 5:

Started on this. Have a test and fix but have to step away from my computer for a while.

@robpike
Copy link
Contributor

robpike commented Aug 3, 2013

Comment 6:

This issue was closed by revision 53d9b6f.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe 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

5 participants