1
0
mirror of https://github.com/golang/go synced 2024-11-25 08:47:56 -07:00

html/template: make Must work

Fixes #2545.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5475054
This commit is contained in:
Rob Pike 2011-12-09 10:47:36 -08:00
parent 8c0b699ca4
commit 5912869d61

View File

@ -183,7 +183,9 @@ func (t *Template) Lookup(name string) *Template {
// Must panics if err is non-nil in the same way as template.Must.
func Must(t *Template, err error) *Template {
t.text = template.Must(t.text, err)
if err != nil {
panic(err)
}
return t
}