Skip to content

Commit

Permalink
encoding/asn1: use reflect.TypeFor for known types
Browse files Browse the repository at this point in the history
  • Loading branch information
apocelipes committed Aug 30, 2023
1 parent 1f8f2ab commit d519835
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/encoding/asn1/asn1.go
Expand Up @@ -656,14 +656,14 @@ func parseSequenceOf(bytes []byte, sliceType reflect.Type, elemType reflect.Type
}

var (
bitStringType = reflect.TypeOf(BitString{})
objectIdentifierType = reflect.TypeOf(ObjectIdentifier{})
enumeratedType = reflect.TypeOf(Enumerated(0))
flagType = reflect.TypeOf(Flag(false))
timeType = reflect.TypeOf(time.Time{})
rawValueType = reflect.TypeOf(RawValue{})
rawContentsType = reflect.TypeOf(RawContent(nil))
bigIntType = reflect.TypeOf((*big.Int)(nil))
bitStringType = reflect.TypeFor[BitString]()
objectIdentifierType = reflect.TypeFor[ObjectIdentifier]()
enumeratedType = reflect.TypeFor[Enumerated]()
flagType = reflect.TypeFor[Flag]()
timeType = reflect.TypeFor[time.Time]()
rawValueType = reflect.TypeFor[RawValue]()
rawContentsType = reflect.TypeFor[RawContent]()
bigIntType = reflect.TypeFor[*big.Int]()
)

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

0 comments on commit d519835

Please sign in to comment.