title: Parse yaml to struct with dynamic fields
body: <p>I use the following code to parse yaml to struct which works okay.
  Now let's assume that I have a struct like <code>install</code> which I know to have two const <code>properties</code> like <code>Name</code> and <code>Group</code> <strong>but</strong> in addition we can have additional <code>key val properties</code> which could change, <strong>you can get any key val properties</strong> (dynamic)</p>
  
  <p>How should I define this struct? the idea is to read the yaml file modify some values and <strong>write it back</strong> (with exact same structure with modified value) to <strong>FS</strong>, <strong>therefore</strong> I don't want to miss some dynamically fields which could be in the some yaml file which need to be modified</p>
  
  <p>package main</p>
  
  <pre><code>import (
      "fmt"
      "log"
  
      "github.com/go-yaml/yaml"
  )
  
  type File struct {
      TypeVersion string `yaml:"_type-version"`
      Dependency []Dependency
  }
  
  type Dependency struct {
      Name     string
      Type     string
      CWD      string
      Install  []Install
      Requires []Requires
  }
  
  type Install struct {
      Name  string
      Group string
     //Here any key value can be
  }
  
  type Requires struct {
      Name string
      Type string
  }
  
  var data = `
  _type-version: "1.0.0"
  dependency:
    - name: ui
      type: runner
      cwd: /ui
      install:
         - name: api
           group: test
      requires:
        - name: db
        - type: mongo
        - name: rst
        - name: test
        - name: test2
  `
  
  func main() {
      f := File{}
  
      err := yaml.Unmarshal([]byte(data), &amp;f)
      if err != nil {
          log.Fatalf("error: %v", err)
      }
      fmt.Printf("--- t:\n%v\n\n", f)
  
      d, err := yaml.Marshal(&amp;f)
      if err != nil {
          log.Fatalf("error: %v", err)
      }
      fmt.Printf("--- t dump:\n%s\n\n", string(d))
  }
  </code></pre>
  
  <p>Example 
  <code>Install</code> can be like above and also like this</p>
  
  <pre><code>    install:
         - name: api
           group: test
           a1:test2
           b1:test2
  </code></pre>
  
  <p>And also</p>
  
  <pre><code>   install:
             - name: api
               group: test
               z10:123
               zzz:111
  </code></pre>
  
  <p>And many more fields after <code>name</code> and <code>group</code></p>