]> Sergey Matveev's repositories - btrtrc.git/commitdiff
bencode: get type of `big.Int` without creating instance (#651)
authorYenForYang <YenForYang@users.noreply.github.com>
Sat, 18 Sep 2021 02:44:47 +0000 (21:44 -0500)
committerGitHub <noreply@github.com>
Sat, 18 Sep 2021 02:44:47 +0000 (12:44 +1000)
Nope, it doesn't really matter. But anyway, see https://github.com/golang/crypto/blob/c084706c2272f3d44b722e988e70d4a58e60e7f4/cryptobyte/asn1.go#L267

bencode/encode.go

index 05153a8c273beb5d62a5bc035b31b02fc71a11f3..4c7c860254bb8e72dc4e066f34908137c8d0ace5 100644 (file)
@@ -96,7 +96,7 @@ func (e *Encoder) reflectMarshaler(v reflect.Value) bool {
        return true
 }
 
-var bigIntType = reflect.TypeOf(big.Int{})
+var bigIntType = reflect.TypeOf((*big.Int)(nil)).Elem()
 
 func (e *Encoder) reflectValue(v reflect.Value) {