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/multi_test.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/multi_test.go')
| -rw-r--r-- | src/text/template/multi_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/text/template/multi_test.go b/src/text/template/multi_test.go index e4e804880a..d79c20dc1a 100644 --- a/src/text/template/multi_test.go +++ b/src/text/template/multi_test.go @@ -290,3 +290,9 @@ func TestRedefinition(t *testing.T) { t.Fatalf("expected redefinition error; got %v", err) } } + +// Issue 10879 +func TestEmptyTemplateCloneCrash(t *testing.T) { + t1 := New("base") + t1.Clone() // used to panic +} |
