title: Use range over struct in GO templates
body: <p>I parse the struct from <code>values.yaml</code> and want to use it in <code>template.yaml</code></p>
  
  <p>Here is my <code>values.yaml</code> file:</p>
  
  <pre><code>services:
    app:
      image: matryoshka/app
      replicaCount: 1
    cron:
      image: matryoshka/cron
      replicaCount: 1
  </code></pre>
  
  <p>And here is my <code>template.yaml</code> (NOT VALID CODE):</p>
  
  <pre><code>{{- range $key, $value := .Services}}
      {{$key}}{{$value}}
  {{- end}}
  </code></pre>
  
  <p>Which gives me error:</p>
  
  <pre><code>panic: template: template.yaml:1:26: executing "template.yaml" at &lt;.Services&gt;: range can't iterate over {{atryoshka/app 1} {matryoshka/cron 1}}
  </code></pre>
  
  <p>Here is my <code>.go</code> code:</p>
  
  <pre><code>package main
  
  import (
      "html/template"
      "io/ioutil"
      "os"
      "path/filepath"
  
      "gopkg.in/yaml.v2"
  )
  
  type Values struct {
      Services struct {
          App struct {
              Image        string `yaml:"image"`
              ReplicaCount string `yaml:"replicaCount"`
          } `yaml:"app"`
          Cron struct {
              Image        string `yaml:"image"`
              ReplicaCount string `yaml:"replicaCount"`
          } `yaml:"cron"`
      }
  }
  
  func parseValues() Values {
  
      var values Values
      filename, _ := filepath.Abs("./values.yaml")
      yamlFile, err := ioutil.ReadFile(filename)
  
      err = yaml.Unmarshal(yamlFile, &amp;values)
      if err != nil {
          panic(err)
      }
  
      return values
  
  }
  func insertValues(class Values) {
      paths := []string{"template.yaml"}
      t, err := template.New(paths[0]).ParseFiles(paths...)
      if err != nil {
          panic(err)
      }
      err = t.Execute(os.Stdout, class)
      if err != nil {
          panic(err)
      }
  }
  
  func main() {
      values := parseValues()
      insertValues(values)
  }
  </code></pre>
  
  <p>How can I iterate over <code>.Services</code> in <code>template.yaml</code> correctly? I found only option with <code>{{- range $key, $value := .Services}}</code> but it doesn't work.</p>