Skip to content

Instantly share code, notes, and snippets.

@masahide
Created February 23, 2014 07:42
Show Gist options
  • Save masahide/9168362 to your computer and use it in GitHub Desktop.
Save masahide/9168362 to your computer and use it in GitHub Desktop.
go でmapや配列等を pretty print (var_dumpみたいな何か)と yaml の読み込み ref: http://qiita.com/yamasaki-masahide/items/327ad9c423de1e35215f
mail_from: masahide.y@gmail.com
to: [masahide.y@gmail.com]
var:
c: 2
d: [3, 4]
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),
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment