1
0
mirror of https://github.com/golang/go synced 2024-10-02 08:08:33 -06:00

text/template: avoid assiging unnecessary variable

This follows up CL95235

Change-Id: I62652654e5bb46d2f8f37af468e1fbcc1835bb8a
Reviewed-on: https://go-review.googlesource.com/95295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Kunpei Sakai 2018-02-20 08:42:11 +09:00 committed by Ian Lance Taylor
parent d4b2168b23
commit af7fc752b1

View File

@ -125,8 +125,7 @@ func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error
nt = t.New(name)
}
// Even if nt == t, we need to install it in the common.tmpl map.
replace := t.associate(nt, tree)
if replace || nt.Tree == nil {
if t.associate(nt, tree) || nt.Tree == nil {
nt.Tree = tree
}
return nt, nil