-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: text/template: New template option additionalkey
#57857
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
Comments
additionalkey
additionalkey
additionalkey
In helm, everything is under |
cc @robpike |
I do not understand this proposal. How does one "provide" a key to a map yet have it be "unused"? Is the question, if I build a data structure (using a map, but maybe that's not important), pass it to a template, and don't use a field of it during execution, raise an error? If so, that is not something I would be in favor of doing in the template library. It's too peculiar a desire for a general-purpose library, and never a correctness problem in the template itself. If you must address this, you could use one of the static analyzers if it's the static problem you're after; if it's the dynamic one, you're looking for a solution in the wrong place. |
Yes, that's exactly the question/proposal. Thanks for the quick and thoughtful responses. I'll close this issue and find a fix elsewhere. |
👋 Hey folks, I'd like to add a new option when rendering templates that will error in the event that there are additional fields in the input. The original issue I'm trying to fix is in helm, so if anyone has an alternative solution to that, I'm open to it.
Then the following code (taken from the text/template example) would panic
The text was updated successfully, but these errors were encountered: