better comment in converter for yaml validation

Signed-off-by: Thomas Gazagnaire <thomas@gazagnaire.org>
This commit is contained in:
Thomas Gazagnaire 2017-04-12 14:09:46 +02:00
parent 02038f512d
commit b9a964060b

View File

@ -81,8 +81,10 @@ type MobyImage struct {
Sysctl map[string]string Sysctl map[string]string
} }
// recursively convert the map keys from `interface{}` to `string` // github.com/go-yaml/yaml treats map keys as interface{} while encoding/json
// this is needed to convert "yaml" interfaces to "JSON" interfaces // requires them to be strings, integers or to implement encoding.TextMarshaler.
// Fix this up by recursively mapping all map[interface{}]interface{} types into
// map[string]interface{}.
// see http://stackoverflow.com/questions/40737122/convert-yaml-to-json-without-struct-golang#answer-40737676 // see http://stackoverflow.com/questions/40737122/convert-yaml-to-json-without-struct-golang#answer-40737676
func convert(i interface{}) interface{} { func convert(i interface{}) interface{} {
switch x := i.(type) { switch x := i.(type) {