title: Go Unmarshal YAML into struct with maps
body: <p>I'm attempting to unmarshal a YAML file into a struct containing two maps (using <a href="https://github.com/go-yaml/yaml" rel="nofollow">go-yaml</a>).</p>
  
  <p>YAML-file:</p>
  
  <pre><code>'Include':
      - 'string1'
      - 'string2'
  
  'Exclude':
      - 'string3'
      - 'string4'
  </code></pre>
  
  <p>The struct:</p>
  
  <pre><code>type Paths struct {
      Include map[string]struct{}
      Exclude map[string]struct{}
  }
  </code></pre>
  
  <p>A simplified version (i.e. removed error handling etc.) of the function attempting to unmarshal:</p>
  
  <pre><code>import "gopkg.in/yaml.v2"
  
  func getYamlPaths(filename string) (Paths, error) {
      loadedPaths := Paths{
          Include: make(map[string]struct{}),
          Exclude: make(map[string]struct{}),
      }
  
      filenameabs, _ := filepath.Abs(filename)
      yamlFile, err := ioutil.ReadFile(filenameabs)
  
      err = yaml.Unmarshal(yamlFile, &amp;loadedPaths)
      return loadedPaths, nil
  }
  </code></pre>
  
  <p>Data is being read from the file, but the unmarshal-function is not putting anything into the struct, and is returning no errors.</p>
  
  <p>I suspect that the unmarshal-function cannot turn the YAML collections into <code>map[string]struct{}</code>, but as mentioned it is producing no errors, and I've looked around for similar issues and can't seem to find any.</p>
  
  <p>Any clues or insight would be much appreciated!</p>