title: Go template name
body: <p>In the <code>html/template</code> (and <code>text/template</code>) packages, <a href="https://golang.org/pkg/html/template/#New" rel="noreferrer"><code>template.New</code></a> has the following signature:</p>
  
  <pre><code>func New(name string) *Template
  </code></pre>
  
  <p>What exactly is the <code>name</code> used for? I've scanned the docs (and a bit of source), but to no avail. I just instantiate all of my templates with an empty string and it doesn't seem to make a difference. Why should I bother with a name?</p>
  
  <p>Even for naming templates, the two seem equivalent:</p>
  
  <pre><code>template.Must(template.New("").Parse(`{{ define "body" }}Body{{ end }}`))
  template.Must(template.New("body").Parse(`Body`))
  </code></pre>
  
  <p><a href="https://play.golang.org/p/wKzCHdLf2S" rel="noreferrer">https://play.golang.org/p/wKzCHdLf2S</a></p>