yamlは、https://godoc.org/launchpad.net/goyaml を、
pretty printは http://godoc.org/github.com/kr/pretty を使えばいい感じです。
config
mail_from: masahide.y@gmail.com
to: [masahide.y@gmail.com]
var:
c: 2
d: [3, 4]
example.go
m := make(map[interface{}]interface{})
err = goyaml.Unmarshal([]byte(config), &m)
if err != nil {
panic(err)
}
//fmt.Printf("--- m:\n%# v\n\n", m)
pretty.Printf("--- m:\n%# v\n\n", m)
$ go run main.go
--- m:
map[interface {}]interface {}{
"mail_from": "masahide.y@gmail.com",
"to": []interface {}{
"masahide.y@gmail.com",
},
"var": map[interface {}]interface {}{
"c": int(2),
"d": []interface {}{
int(3),
int(4),
},
},
}