diff options
| author | Aamir Khan <syst3m.w0rm@gmail.com> | 2015-05-19 13:49:53 +0900 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2015-06-01 19:51:13 +0000 |
| commit | 8801bdf2b3cb8f3d59664f56fba7eeb7a2cf0bdb (patch) | |
| tree | 6ccd30c163979ba5438bbf58ab802a3172ffc8dd /src/text/template/exec.go | |
| parent | bc8e129366ebc4244026884319c68c31c3127853 (diff) | |
| download | go-8801bdf2b3cb8f3d59664f56fba7eeb7a2cf0bdb.tar.xz | |
text/template: template must be initialized at the time of creation
t.init() should be called at the time of template creation
i.e, template.New() and t.New() instead of later in the process.
- Removed calls of t.init() from t.Parse(), t.Execute(), t.Funcs()
- Also got rid of t.common != nil checks as it should never be nil
Fixes #10879
Change-Id: I1b7ac812f02c841ae80037babce7e2b0a2df13e8
Reviewed-on: https://go-review.googlesource.com/10240
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/text/template/exec.go')
| -rw-r--r-- | src/text/template/exec.go | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/src/text/template/exec.go b/src/text/template/exec.go index ebafb4b5dc..b4e6cc8282 100644 --- a/src/text/template/exec.go +++ b/src/text/template/exec.go @@ -134,7 +134,6 @@ func (t *Template) Execute(wr io.Writer, data interface{}) (err error) { wr: wr, vars: []variable{{"$", value}}, } - t.init() if t.Tree == nil || t.Root == nil { state.errorf("%q is an incomplete or empty template%s", t.Name(), t.DefinedTemplates()) } @@ -147,9 +146,6 @@ func (t *Template) Execute(wr io.Writer, data interface{}) (err error) { // it returns the empty string. For generating an error message here // and in html/template. func (t *Template) DefinedTemplates() string { - if t.common == nil { - return "" - } var b bytes.Buffer for name, tmpl := range t.tmpl { if tmpl.Tree == nil || tmpl.Root == nil { |
