mirror of
https://github.com/golang/go
synced 2024-11-13 17:50:23 -07:00
text/template: rename the method Template.Template to Template.Lookup
Calling it Template makes it clumsy to embed the type, which html/template depends on. R=golang-dev, gri CC=golang-dev https://golang.org/cl/5432079
This commit is contained in:
parent
e38a1053a9
commit
e9025df7ad
@ -677,7 +677,7 @@ func TestTree(t *testing.T) {
|
|||||||
}
|
}
|
||||||
const expect = "[1[2[3[4]][5[6]]][7[8[9]][10[11]]]]"
|
const expect = "[1[2[3[4]][5[6]]][7[8[9]][10[11]]]]"
|
||||||
// First by looking up the template.
|
// First by looking up the template.
|
||||||
err = tmpl.Template("tree").Execute(&b, tree)
|
err = tmpl.Lookup("tree").Execute(&b, tree)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("exec error:", err)
|
t.Fatal("exec error:", err)
|
||||||
}
|
}
|
||||||
|
@ -136,9 +136,9 @@ func (t *Template) Funcs(funcMap FuncMap) *Template {
|
|||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
// Template returns the template with the given name that is associated with t,
|
// Lookup returns the template with the given name that is associated with t,
|
||||||
// or nil if there is no such template.
|
// or nil if there is no such template.
|
||||||
func (t *Template) Template(name string) *Template {
|
func (t *Template) Lookup(name string) *Template {
|
||||||
return t.tmpl[name]
|
return t.tmpl[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user