From ba4840c52becf73c2749c9ef0f2f09ed0b9d5c7f Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Sun, 12 Feb 2017 22:24:33 +0000 Subject: Update dependencies --- vendor/github.com/fatih/structs/structs.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'vendor/github.com/fatih/structs') diff --git a/vendor/github.com/fatih/structs/structs.go b/vendor/github.com/fatih/structs/structs.go index 06da620..be3816a 100644 --- a/vendor/github.com/fatih/structs/structs.go +++ b/vendor/github.com/fatih/structs/structs.go @@ -530,15 +530,22 @@ func (s *Struct) nested(val reflect.Value) interface{} { finalVal = m } case reflect.Map: - v := val.Type().Elem() - if v.Kind() == reflect.Ptr { - v = v.Elem() + // get the element type of the map + mapElem := val.Type() + switch val.Type().Kind() { + case reflect.Ptr, reflect.Array, reflect.Map, + reflect.Slice, reflect.Chan: + mapElem = val.Type().Elem() + if mapElem.Kind() == reflect.Ptr { + mapElem = mapElem.Elem() + } } // only iterate over struct types, ie: map[string]StructType, // map[string][]StructType, - if v.Kind() == reflect.Struct || - (v.Kind() == reflect.Slice && v.Elem().Kind() == reflect.Struct) { + if mapElem.Kind() == reflect.Struct || + (mapElem.Kind() == reflect.Slice && + mapElem.Elem().Kind() == reflect.Struct) { m := make(map[string]interface{}, val.Len()) for _, k := range val.MapKeys() { m[k.String()] = s.nested(val.MapIndex(k)) -- cgit v1.2.3