Last active
March 3, 2020 16:21
-
-
Save sochoa/42bcea4c6e137efb57c2308a5dd280ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This results in the following:
yaml: line 2: found character that cannot start any token
, and i'm wondering why.