Skip to content

Commit d519835

Browse files
committed
encoding/asn1: use reflect.TypeFor for known types
For #60088
1 parent 1f8f2ab commit d519835

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/encoding/asn1/asn1.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,14 @@ func parseSequenceOf(bytes []byte, sliceType reflect.Type, elemType reflect.Type
656656
}
657657

658658
var (
659-
bitStringType = reflect.TypeOf(BitString{})
660-
objectIdentifierType = reflect.TypeOf(ObjectIdentifier{})
661-
enumeratedType = reflect.TypeOf(Enumerated(0))
662-
flagType = reflect.TypeOf(Flag(false))
663-
timeType = reflect.TypeOf(time.Time{})
664-
rawValueType = reflect.TypeOf(RawValue{})
665-
rawContentsType = reflect.TypeOf(RawContent(nil))
666-
bigIntType = reflect.TypeOf((*big.Int)(nil))
659+
bitStringType = reflect.TypeFor[BitString]()
660+
objectIdentifierType = reflect.TypeFor[ObjectIdentifier]()
661+
enumeratedType = reflect.TypeFor[Enumerated]()
662+
flagType = reflect.TypeFor[Flag]()
663+
timeType = reflect.TypeFor[time.Time]()
664+
rawValueType = reflect.TypeFor[RawValue]()
665+
rawContentsType = reflect.TypeFor[RawContent]()
666+
bigIntType = reflect.TypeFor[*big.Int]()
667667
)
668668

669669
// invalidLength reports whether offset + length > sliceLength, or if the

0 commit comments

Comments
 (0)