diff --git a/tape/dynamic.go b/tape/dynamic.go index e2b1b86..c0e5301 100644 --- a/tape/dynamic.go +++ b/tape/dynamic.go @@ -69,7 +69,7 @@ func DecodeAny(decoder *Decoder, destination any, tag Tag) (n int, err error) { func decodeAny(decoder *Decoder, destination reflect.Value, tag Tag) (n int, err error) { errWrongDestinationType := func(expected string) error { return fmt.Errorf( - "expected %s destination, not %v", + "expected &%s destination, not %v", expected, destination) } @@ -138,14 +138,8 @@ func decodeAny(decoder *Decoder, destination reflect.Value, tag Tag) (n int, err case KTV: // KTV: ( )* table := destination.Elem() - if table.Kind() != reflect.Map { - return n, errWrongDestinationType("map") - } - typ := table.Type() - if typ.Key().Kind() != reflect.Uint16 { - return n, errWrongDestinationType("map[uint16]") - } - if typ.Elem() != reflect.TypeOf(any(nil)) { + var dummyMap map[uint16] any + if table.Type() != reflect.TypeOf(dummyMap) { return n, errWrongDestinationType("map[uint16] any") } length, nn, err := decoder.ReadUintN(tag.CN() - 1)