Skip to content

Instantly share code, notes, and snippets.

@sochoa
Last active March 3, 2020 16:21
Show Gist options
  • Save sochoa/42bcea4c6e137efb57c2308a5dd280ec to your computer and use it in GitHub Desktop.
Save sochoa/42bcea4c6e137efb57c2308a5dd280ec to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"gopkg.in/yaml.v3"
)
type Region struct {
ids []string `yaml:",inline"`
}
type Realm struct {
regions map[string]Region `yaml:",inline"`
}
func main() {
yaml_bytes := `
realm1:
region1:
- id123
- id456
realm2:
region2:
- id789
- id678
`
var realm map[string]Realm = make(map[string]Realm, 0)
fmt.Println(fmt.Sprintf("%v", yaml.Unmarshal([]byte(yaml_bytes), &realm)))
}
@sochoa
Copy link
Author

sochoa commented Mar 3, 2020

This results in the following: yaml: line 2: found character that cannot start any token, and i'm wondering why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment