title: How to check if a golang template has all the variables available in the data variable?
body: <p>I am trying to render a string from the  Golangs Template and populating template variables with a map.</p>
  <p>I need to have a check as to if the all the variables are available in the map.</p>
  <p>Expected the below piece of code to throw an error.</p>
  <pre><code>templateVariables := map[string]string {} 
  tmpl := template.New(&quot;test&quot;)
  tmpl, err := tmpl.Parse(&quot;Hello {{.Name}}\n&quot;)
  if err != nil {
          log.Fatal(&quot;Parse: &quot;, err)
          return
  }
  
  buf := bytes.NewBufferString(&quot;&quot;)
  err1 := tmpl.Execute(buf,s)
  if err1 != nil { 
      // Expected this to be true
      log.Panic(err1)
  
  }
  fmt.print(buf.String())
  </code></pre>
  <p>Executing above throws no Error and the value of <code>buf</code> from fmt.print turns out to be:
  <code>Hello &lt;no value&gt;</code></p>
  <p>How does one ensure that all the required variables in the map are available, if not throw an error? Is there a way to do this from templates package itself?</p>