aboutsummaryrefslogtreecommitdiff
path: root/src/text
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2017-03-20 20:18:02 -0700
committerRob Pike <r@golang.org>2017-03-21 04:07:35 +0000
commit5c5a10690e56bf127832b98d73c83720e0093eef (patch)
tree54c37e6701457fe38ad80686d5da12929fb4ef4b /src/text
parent0dafb7d9624c4c2bc876f03f2a6fa8d4a2ce6963 (diff)
downloadgo-5c5a10690e56bf127832b98d73c83720e0093eef.tar.xz
text/template,html/template: state that Funcs must happen before parsing
Any method that affects the parse must happen before parsing. This obvious point is clear, but it's not clear to some that the set of defined functions affect the parse. Fixes #18971 Change-Id: I8b7f8c8cf85b028c18e5ca3b9797de92ea910669 Reviewed-on: https://go-review.googlesource.com/38413 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/text')
-rw-r--r--src/text/template/template.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/text/template/template.go b/src/text/template/template.go
index b6fceb1795..ed1ef3cf8d 100644
--- a/src/text/template/template.go
+++ b/src/text/template/template.go
@@ -159,6 +159,7 @@ func (t *Template) Delims(left, right string) *Template {
}
// Funcs adds the elements of the argument map to the template's function map.
+// It must be called before the template is parsed.
// It panics if a value in the map is not a function with appropriate return
// type or if the name cannot be used syntactically as a function in a template.
// It is legal to overwrite elements of the map. The return value is the template,