Skip to content

Commit dffc47e

Browse files
apocelipesgopherbot
authored andcommitted
encoding/asn1: use reflect.TypeFor for known types
For #60088 Change-Id: I4b2a5c6c59ef26361f343052a4ddaabde5d3bc94 GitHub-Last-Rev: d519835 GitHub-Pull-Request: #62370 Reviewed-on: https://go-review.googlesource.com/c/go/+/524259 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent 6f11650 commit dffc47e

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)