From 58b8919a1e8e2eaeb5e6b930c46a424ae916d429 Mon Sep 17 00:00:00 2001 From: Greg Date: Thu, 4 Jul 2024 02:03:29 +0900 Subject: [PATCH] improve error message for invalid map value decode --- decodefunc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decodefunc.go b/decodefunc.go index 95dba40..39eac86 100644 --- a/decodefunc.go +++ b/decodefunc.go @@ -203,7 +203,7 @@ func decodeMap(decodeKey func(reflect.Value, string) error) func(plan *typedef, } innerRV := reflect.New(rv.Type().Elem()) if err := plan.decodeAttr(flags, v, innerRV.Elem()); err != nil { - return fmt.Errorf("error decoding key %q into %v", name, kp.Type().Elem()) + return fmt.Errorf("error decoding map entry %q (%s) into type %v", name, avTypeName(v), innerRV.Type().Elem()) } rv.SetMapIndex(kp.Elem(), innerRV.Elem()) }