@@ -39,7 +39,7 @@ import (
3939// unmarshals CBOR into the value pointed to by the pointer. If the
4040// pointer is nil, Unmarshal creates a new value for it to point to.
4141//
42- // To unmarshal CBOR into an empty interface value , Unmarshal uses the
42+ // To unmarshal CBOR into a value of type any , Unmarshal uses the
4343// following rules:
4444//
4545// CBOR booleans decode to bool.
@@ -48,8 +48,8 @@ import (
4848// CBOR floating points decode to float64.
4949// CBOR byte strings decode to []byte.
5050// CBOR text strings decode to string.
51- // CBOR arrays decode to []interface{} .
52- // CBOR maps decode to map[interface{}]interface{} .
51+ // CBOR arrays decode to []any .
52+ // CBOR maps decode to map[any]any .
5353// CBOR null and undefined values decode to nil.
5454// CBOR times (tag 0 and 1) decode to time.Time.
5555// CBOR bignums (tag 2 and 3) decode to big.Int.
@@ -299,7 +299,7 @@ func (e *InadmissibleTagContentTypeError) Error() string {
299299
300300// DupMapKeyMode specifies how to enforce duplicate map key. Two map keys are considered duplicates if:
301301// 1. When decoding into a struct, both keys match the same struct field. The keys are also
302- // considered duplicates if neither matches any field and decoding to interface{} would produce
302+ // considered duplicates if neither matches any field and decoding to a value of type any would produce
303303// equal (==) values for both keys.
304304// 2. When decoding into a map, both keys are equal (==) when decoded into values of the
305305// destination map's key type.
@@ -360,19 +360,19 @@ func (tm TagsMode) valid() bool {
360360}
361361
362362// IntDecMode specifies which Go type (int64, uint64, or big.Int) should
363- // be used when decoding CBOR integers (major type 0 and 1) to Go interface{} .
363+ // be used when decoding CBOR integers (major type 0 and 1) to a value of type any .
364364type IntDecMode int
365365
366366const (
367- // IntDecConvertNone affects how CBOR integers (major type 0 and 1) decode to Go interface{} .
367+ // IntDecConvertNone affects how CBOR integers (major type 0 and 1) decode to a value of type any .
368368 // It decodes CBOR unsigned integer (major type 0) to:
369369 // - uint64
370370 // It decodes CBOR negative integer (major type 1) to:
371371 // - int64 if value fits
372372 // - big.Int or *big.Int (see BigIntDecMode) if value doesn't fit into int64
373373 IntDecConvertNone IntDecMode = iota
374374
375- // IntDecConvertSigned affects how CBOR integers (major type 0 and 1) decode to Go interface{} .
375+ // IntDecConvertSigned affects how CBOR integers (major type 0 and 1) decode to a value of type any .
376376 // It decodes CBOR integers (major type 0 and 1) to:
377377 // - int64 if value fits
378378 // - big.Int or *big.Int (see BigIntDecMode) if value < math.MinInt64
@@ -382,13 +382,13 @@ const (
382382 // Please use other options, such as IntDecConvertSignedOrError, IntDecConvertSignedOrBigInt, IntDecConvertNone.
383383 IntDecConvertSigned
384384
385- // IntDecConvertSignedOrFail affects how CBOR integers (major type 0 and 1) decode to Go interface{} .
385+ // IntDecConvertSignedOrFail affects how CBOR integers (major type 0 and 1) decode to a value of type any .
386386 // It decodes CBOR integers (major type 0 and 1) to:
387387 // - int64 if value fits
388388 // - return UnmarshalTypeError if value doesn't fit into int64
389389 IntDecConvertSignedOrFail
390390
391- // IntDecConvertSignedOrBigInt affects how CBOR integers (major type 0 and 1) decode to Go interface{} .
391+ // IntDecConvertSignedOrBigInt affects how CBOR integers (major type 0 and 1) decode to a value of type any .
392392 // It makes CBOR integers (major type 0 and 1) decode to:
393393 // - int64 if value fits
394394 // - big.Int or *big.Int (see BigIntDecMode) if value doesn't fit into int64
@@ -402,10 +402,10 @@ func (idm IntDecMode) valid() bool {
402402}
403403
404404// MapKeyByteStringMode specifies how to decode CBOR byte string (major type 2)
405- // as Go map key when decoding CBOR map key into an empty Go interface value .
405+ // as Go map key when decoding CBOR map key into a value of type any .
406406// Specifically, this option applies when decoding CBOR map into
407- // - Go empty interface , or
408- // - Go map with empty interface as key type.
407+ // - any , or
408+ // - Go map with type any as key type.
409409// The CBOR map key types handled by this option are
410410// - byte string
411411// - tagged byte string
@@ -420,7 +420,7 @@ const (
420420 MapKeyByteStringAllowed MapKeyByteStringMode = iota
421421
422422 // MapKeyByteStringForbidden forbids CBOR byte string being decoded as Go map key.
423- // Attempting to decode CBOR byte string as map key into empty interface value
423+ // Attempting to decode CBOR byte string as map key into a value of type any
424424 // returns a decoding error.
425425 MapKeyByteStringForbidden
426426
@@ -489,16 +489,16 @@ func (fnmm FieldNameMatchingMode) valid() bool {
489489 return fnmm >= 0 && fnmm < maxFieldNameMatchingMode
490490}
491491
492- // BigIntDecMode specifies how to decode CBOR bignum to Go interface{} .
492+ // BigIntDecMode specifies how to decode CBOR bignum to a value of type any .
493493type BigIntDecMode int
494494
495495const (
496496 // BigIntDecodeValue makes CBOR bignum decode to big.Int (instead of *big.Int)
497- // when unmarshaling into a Go interface{} .
497+ // when unmarshaling into a value of type any .
498498 BigIntDecodeValue BigIntDecMode = iota
499499
500500 // BigIntDecodePointer makes CBOR bignum decode to *big.Int when
501- // unmarshaling into a Go interface{} .
501+ // unmarshaling into a value of type any .
502502 BigIntDecodePointer
503503
504504 maxBigIntDecMode
@@ -549,17 +549,17 @@ func (fnbsm FieldNameByteStringMode) valid() bool {
549549 return fnbsm >= 0 && fnbsm < maxFieldNameByteStringMode
550550}
551551
552- // UnrecognizedTagToAnyMode specifies how to decode unrecognized CBOR tag into an empty interface ( any) .
552+ // UnrecognizedTagToAnyMode specifies how to decode unrecognized CBOR tag into a value of type any.
553553// Currently, recognized CBOR tag numbers are 0, 1, 2, 3, or registered by TagSet.
554554type UnrecognizedTagToAnyMode int
555555
556556const (
557557 // UnrecognizedTagNumAndContentToAny decodes CBOR tag number and tag content to cbor.Tag
558- // when decoding unrecognized CBOR tag into an empty interface .
558+ // when decoding unrecognized CBOR tag into a value of type any .
559559 UnrecognizedTagNumAndContentToAny UnrecognizedTagToAnyMode = iota
560560
561561 // UnrecognizedTagContentToAny decodes only CBOR tag content (into its default type)
562- // when decoding unrecognized CBOR tag into an empty interface .
562+ // when decoding unrecognized CBOR tag into a value of type any .
563563 UnrecognizedTagContentToAny
564564
565565 maxUnrecognizedTagToAny
@@ -569,21 +569,21 @@ func (uttam UnrecognizedTagToAnyMode) valid() bool {
569569 return uttam >= 0 && uttam < maxUnrecognizedTagToAny
570570}
571571
572- // TimeTagToAnyMode specifies how to decode CBOR tag 0 and 1 into an empty interface ( any) .
572+ // TimeTagToAnyMode specifies how to decode CBOR tag 0 and 1 into a value of type any.
573573// Based on the specified mode, Unmarshal can return a time.Time value or a time string in a specific format.
574574type TimeTagToAnyMode int
575575
576576const (
577577 // TimeTagToTime decodes CBOR tag 0 and 1 into a time.Time value
578- // when decoding tag 0 or 1 into an empty interface .
578+ // when decoding tag 0 or 1 into a value of type any .
579579 TimeTagToTime TimeTagToAnyMode = iota
580580
581581 // TimeTagToRFC3339 decodes CBOR tag 0 and 1 into a time string in RFC3339 format
582- // when decoding tag 0 or 1 into an empty interface .
582+ // when decoding tag 0 or 1 into a value of type any .
583583 TimeTagToRFC3339
584584
585585 // TimeTagToRFC3339Nano decodes CBOR tag 0 and 1 into a time string in RFC3339Nano format
586- // when decoding tag 0 or 1 into an empty interface .
586+ // when decoding tag 0 or 1 into a value of type any .
587587 TimeTagToRFC3339Nano
588588
589589 maxTimeTagToAnyMode
@@ -818,11 +818,11 @@ type DecOptions struct {
818818 TagsMd TagsMode
819819
820820 // IntDec specifies which Go integer type (int64, uint64, or [big.Int]) to use
821- // when decoding CBOR int (major type 0 and 1) to Go interface{} .
821+ // when decoding CBOR int (major type 0 and 1) to a value of type any .
822822 IntDec IntDecMode
823823
824824 // MapKeyByteString specifies how to decode CBOR byte string as map key
825- // when decoding CBOR map with byte string key into an empty interface value .
825+ // when decoding CBOR map with byte string key into a value of type any .
826826 // By default, an error is returned when attempting to decode CBOR byte string
827827 // as map key because Go doesn't allow []byte as map key.
828828 MapKeyByteString MapKeyByteStringMode
@@ -831,8 +831,8 @@ type DecOptions struct {
831831 ExtraReturnErrors ExtraDecErrorCond
832832
833833 // DefaultMapType specifies Go map type to create and decode to
834- // when unmarshaling CBOR into an empty interface value .
835- // By default, unmarshal uses map[interface{}]interface{} .
834+ // when unmarshaling CBOR into a value of type any .
835+ // By default, unmarshal uses map[any]any .
836836 DefaultMapType reflect.Type
837837
838838 // UTF8 specifies if decoder should decode CBOR Text containing invalid UTF-8.
@@ -842,11 +842,11 @@ type DecOptions struct {
842842 // FieldNameMatching specifies how string keys in CBOR maps are matched to Go struct field names.
843843 FieldNameMatching FieldNameMatchingMode
844844
845- // BigIntDec specifies how to decode CBOR bignum to Go interface{} .
845+ // BigIntDec specifies how to decode CBOR bignum to a value of type any .
846846 BigIntDec BigIntDecMode
847847
848848 // DefaultByteStringType is the Go type that should be produced when decoding a CBOR byte
849- // string into an empty interface value . Types to which a []byte is convertible are valid
849+ // string into a value of type any . Types to which a []byte is convertible are valid
850850 // for this option, except for array and pointer-to-array types. If nil, the default is
851851 // []byte.
852852 DefaultByteStringType reflect.Type
@@ -858,11 +858,11 @@ type DecOptions struct {
858858 // Go struct field name.
859859 FieldNameByteString FieldNameByteStringMode
860860
861- // UnrecognizedTagToAny specifies how to decode unrecognized CBOR tag into an empty interface .
861+ // UnrecognizedTagToAny specifies how to decode unrecognized CBOR tag into a value of type any .
862862 // Currently, recognized CBOR tag numbers are 0, 1, 2, 3, or registered by TagSet.
863863 UnrecognizedTagToAny UnrecognizedTagToAnyMode
864864
865- // TimeTagToAny specifies how to decode CBOR tag 0 and 1 into an empty interface ( any) .
865+ // TimeTagToAny specifies how to decode CBOR tag 0 and 1 into a value of type any.
866866 // Based on the specified mode, Unmarshal can return a time.Time value or a time string in a specific format.
867867 TimeTagToAny TimeTagToAnyMode
868868
@@ -2486,7 +2486,7 @@ func (d *decoder) parseMapToMap(v reflect.Value, tInfo *typeInfo) error { //noli
24862486 keyType , eleType := tInfo .keyTypeInfo .typ , tInfo .elemTypeInfo .typ
24872487 reuseKey , reuseEle := isImmutableKind (tInfo .keyTypeInfo .kind ), isImmutableKind (tInfo .elemTypeInfo .kind )
24882488 var keyValue , eleValue reflect.Value
2489- keyIsInterfaceType := keyType == typeIntf // If key type is interface{} , need to check if key value is hashable.
2489+ keyIsInterfaceType := keyType == typeIntf // If key type is any , need to check if key value is hashable.
24902490 var err , lastErr error
24912491 keyCount := v .Len ()
24922492 var existingKeys map [any ]bool // Store existing map keys, used for detecting duplicate map key.
0 commit comments