]> Cypherpunks repositories - gostls13.git/commit
text/template: clarify the documentation around template definitions
authorRob Pike <r@golang.org>
Tue, 2 Jun 2015 18:49:24 +0000 (11:49 -0700)
committerRob Pike <r@golang.org>
Tue, 2 Jun 2015 21:57:41 +0000 (21:57 +0000)
commitf9ed2f75c43cb8745a1593ec3e4208c46419216a
treee1d52769f09ae3b1be63cd1907c4e1b09edf8b7e
parentfaa7a7e8ae824c78e78b272604f89e834ade6695
text/template: clarify the documentation around template definitions

Due to the requirements of parsing template definitions that mention
other templates that are not yet defined, a Template can be in two states:
defined and undefined. Thus, although one calls New, the resulting
template has no definition even though it exists as a data structure.

Thus, for example, will return nil for a template that is named but not
yet defined.

Fixes #10910
Fixes #10926

Clarify the documentation a little to explain this,
Also tidy up the code a little and remove a spurious call to init.

Change-Id: I22cc083291500bca424e83dc12807e0de7b00b7a
Reviewed-on: https://go-review.googlesource.com/10641
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/text/template/template.go