aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/text
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2014-04-15 08:48:40 -0700
committerRob Pike <r@golang.org>2014-04-15 08:48:40 -0700
commitaeb37527d3795b9677295bb21c0bbb3af18d6f31 (patch)
tree651073268fc919a65aea74f6ea380601e3efd7af /src/pkg/text
parent55e0f36fb46cd3c5b54c4fb0d8444135c3dff0ac (diff)
downloadgo-aeb37527d3795b9677295bb21c0bbb3af18d6f31.tar.xz
text/template: say more often that templates are safe for parallel execution
It was said already but apparently not enough times. Fixes #6985. LGTM=crawshaw R=golang-codereviews, crawshaw CC=golang-codereviews https://golang.org/cl/86300043
Diffstat (limited to 'src/pkg/text')
-rw-r--r--src/pkg/text/template/doc.go2
-rw-r--r--src/pkg/text/template/exec.go2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/pkg/text/template/doc.go b/src/pkg/text/template/doc.go
index f622ac7dce..7c6efd59cd 100644
--- a/src/pkg/text/template/doc.go
+++ b/src/pkg/text/template/doc.go
@@ -20,7 +20,7 @@ The input text for a template is UTF-8-encoded text in any format.
"{{" and "}}"; all text outside actions is copied to the output unchanged.
Actions may not span newlines, although comments can.
-Once constructed, a template may be executed safely in parallel.
+Once parsed, a template may be executed safely in parallel.
Here is a trivial example that prints "17 items are made of wool".
diff --git a/src/pkg/text/template/exec.go b/src/pkg/text/template/exec.go
index 6de37a1996..505509a085 100644
--- a/src/pkg/text/template/exec.go
+++ b/src/pkg/text/template/exec.go
@@ -108,6 +108,7 @@ func errRecover(errp *error) {
// ExecuteTemplate applies the template associated with t that has the given name
// to the specified data object and writes the output to wr.
+// A template may be executed safely in parallel.
func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {
tmpl := t.tmpl[name]
if tmpl == nil {
@@ -118,6 +119,7 @@ func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{})
// Execute applies a parsed template to the specified data object,
// and writes the output to wr.
+// A template may be executed safely in parallel.
func (t *Template) Execute(wr io.Writer, data interface{}) (err error) {
defer errRecover(&err)
value := reflect.ValueOf(data)