title: Go template function
body: <p>It noticed a weird thing with Go templates when I try to use <code>Funcs</code> and <code>FuncMap</code>. The following code works as expected:</p>
  
  <pre><code>buffer := bytes.NewBufferString("")
  
  funcMap := template.FuncMap{
      "label": strings.Title,
  }
  
  t, _ := template.New("alex").Funcs(funcMap).Parse("{{label \"alex\"}}") 
  
  t.Execute(buffer, "")
  
  return string(buffer.Bytes()) //=&gt; "Alex"
  </code></pre>
  
  <p>But when I try to put the template in a file, it does not work (<code>Execute()</code> says: <code>"alex" is an incomplete or empty template</code>):</p>
  
  <pre><code>t, _ := template.New("alex").Funcs(funcMap).ParseFiles("template.html") 
  </code></pre>
  
  <p>With template.html:</p>
  
  <pre><code>{{label \"alex\"}}
  </code></pre>
  
  <p>Any idea why ? Is this a bug ? Are there simpler ways to use methods/functions in templates ?</p>