Skip to content

Instantly share code, notes, and snippets.

@mohae
Created October 25, 2015 04:14
Show Gist options
  • Select an option

  • Save mohae/fab125cbcd25fa9e5807 to your computer and use it in GitHub Desktop.

Select an option

Save mohae/fab125cbcd25fa9e5807 to your computer and use it in GitHub Desktop.
ligature yaml config
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