Created
October 25, 2015 04:14
-
-
Save mohae/fab125cbcd25fa9e5807 to your computer and use it in GitHub Desktop.
ligature yaml config
This file contains hidden or 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.v2" | |
| ) | |
| var cfgYaml = []byte(` | |
| params: | |
| libvirt: | |
| guests: | |
| hostname: | |
| key1: val | |
| key2: val`) | |
| type Cfg struct { | |
| Params | |
| } | |
| type Params struct { | |
| Libvirt | |
| } | |
| type Libvirt struct { | |
| Guests | |
| } | |
| type Guests struct { | |
| Hostname map[string]string | |
| } | |
| func main() { | |
| var cfg Cfg | |
| yaml.Unmarshal(cfgYaml, &cfg) | |
| fmt.Printf("cfg => %+v\n", cfg) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment