-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
text/template: verify that names in FuncMap are valid identifiers
There was no verification in Funcs that the map had valid names, which meant that the error could only be caught when parsing the template that tried to use them. Fix this by validating the names in Funcs and panicking before parsing if there is a bad name. This is arguably an API change, since it didn't trigger a panic before, but Funcs did already panic if the function itself was no good, so I argue it's an acceptable change to add more sanity checks. Fixes golang#9685. Change-Id: Iabf1d0602c49d830f3ed71ca1ccc7eb9a5521ff5 Reviewed-on: https://go-review.googlesource.com/14562 Reviewed-by: Andrew Gerrand <[email protected]>
- Loading branch information
Showing
3 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters