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: Error .. in attribute name #51065

Closed
anoop012345 opened this issue Feb 8, 2022 · 3 comments
Closed

html/template: Error .. in attribute name #51065

anoop012345 opened this issue Feb 8, 2022 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@anoop012345
Copy link

What version of Go are you using (go version)?

$ go1.17 

Does this issue reproduce with the latest release?

yes

What did you do?

I am using "html/template" package, while try to execute the template by using t.Execute(wr io.Writer, data interface{}) function error return : Error : "html/template:test_template: \"'\" in attribute name: \"Emoji';'><br /></span></p>\\n</div\"".

Template content is given below:

<p style="font-family: Lato, sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';">test</p>

@seankhliao
Copy link
Member

please include a reproducible example on go.dev/play
the input you gave doesn't report any errors: https://go.dev/play/p/AVEHUFrDQHt

@seankhliao seankhliao changed the title affected/package: html/template: Error .. in attribute name Feb 8, 2022
@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 8, 2022
@anoop012345
Copy link
Author

I have created the issue here https://go.dev/play/p/qM49YITYZ_c

@robpike
Copy link
Contributor

robpike commented Feb 8, 2022

You're essentially doing a := 'don't do this'. You can't use an unescaped single quote inside a single-quoted string.

Fix is easy: use double quotes around the whole string. https://go.dev/play/p/_oC1n4DeNYh

@robpike robpike closed this as completed Feb 8, 2022
@golang golang locked and limited conversation to collaborators Feb 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants