Hello It seems that the relevant part of the doc is here <https://golang.org/pkg/text/template/#hdr-Associated_templates> :
> Each template is named by a string specified when it is created. Also, > each template is associated with zero or more other templates that it may > invoke by name; such associations are transitive and form a name space of > templates. > So, a *Template always has a name, whether explicitly set by user calling New(name), or automatically assigned by ParseFiles or ParseGlob. Also, you can have nested template definitions <https://golang.org/pkg/text/template/#hdr-Nested_template_definitions>, which create additional template names. At first I thought a *Template would "contain" one or more named "things", but the doc suggests that the right terminology would be "a template may have associated templates". I wrote this example showing that Execute / ExecuteTemplate give different results, for different names invoked : Execute <https://play.golang.org/p/51wCbeez60> ExecuteTemplate "phase1" <https://play.golang.org/p/g55U0-nPv1> ExecuteTemplate "phase2" <https://play.golang.org/p/eHdsbrKDUE> ExecuteTemplate "phase3" <https://play.golang.org/p/9BWFzxpPrM> ExecuteTemplate "wrongName" <https://play.golang.org/p/A_mxV1XJjw> Cheers Val On Friday, September 9, 2016 at 2:18:44 PM UTC+2, mir.an...@gmail.com wrote: > > Hi, > > func (t *Template) Execute(wr io.Writer, data interface{}) error > func (t *Template) ExecuteTemplate(wr io.Writer, name string, data > interface{}) error > > Can someone tell me the difference between the above two functions ? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.