diff --git a/data_navigator.go b/data_navigator.go index ce3a8897..d6f40087 100644 --- a/data_navigator.go +++ b/data_navigator.go @@ -10,7 +10,7 @@ import ( func entryInSlice(context yaml.MapSlice, key interface{}) *yaml.MapItem { for idx := range context { var entry = &context[idx] - if entry.Key == key { + if fmt.Sprintf("%v", entry.Key) == key { return entry } } @@ -115,6 +115,7 @@ func writeArray(context interface{}, paths []string, value interface{}) []interf } func readMap(context yaml.MapSlice, head string, tail []string) (interface{}, error) { + log.Debugf("readingMap %v with key %v\n", context, head) if head == "*" { return readMapSplat(context, tail) } diff --git a/data_navigator_test.go b/data_navigator_test.go index adca0f39..d592d352 100644 --- a/data_navigator_test.go +++ b/data_navigator_test.go @@ -18,6 +18,15 @@ b: assertResult(t, 2, got) } +func TestReadMap_numberKey(t *testing.T) { + var data = parseData(` +--- +200: things +`) + got, _ := readMap(data, "200", []string{}) + assertResult(t, "things", got) +} + func TestReadMap_splat(t *testing.T) { var data = parseData(` ---