Here is my YAML file.
description: fruits are delicious
fruits:
apple:
- red
- sweet
lemon:
- yellow
- sour
I can read a fl
Use a map of string slices to represent the fruit properties:
type Config struct {
Description string
Fruits map[string][]string
}
Printing the unmarshaled configuration with
fmt.Printf("%#v\n", config)
produces the following output (not including the whitespace I added for readability):
main.Config{Description:"fruits are delicious",
Fruits:map[string][]string{
"lemon":[]string{"yellow", "sour"},
"apple":[]string{"red", "sweet"}}}