html/template: improve context representation for user-facing error messages #30635
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/t7FfQjWKEB6
What did you expect to see?
An error message stating that there is an unclosed
<style>
tag, or some similarly helpful messageWhat did you see instead?
Proposed fix
This is due to the fact that escape.go uses the "%v" representation of context to format the returned error.
It would probably be better to show an error based on c.state value, providing a String representation of states (it's not necessary to have it too fine-grained, returning one of
[CSS HTML JS RCDATA Text URL Error]
would probably suffice to debug the issue).The text was updated successfully, but these errors were encountered: