Skip to content

Commit e17e379

Browse files
committed
lint; support go 1.20
1 parent 7c9818a commit e17e379

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

decode_test.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10925,68 +10925,68 @@ func TestFloatPrecisionMode(t *testing.T) {
1092510925
name: "FloatPrecision is not called by default",
1092610926
opts: DecOptions{},
1092710927
in: mustHexDecode("fbc010666666666666"),
10928-
intoType: reflect.TypeFor[float32](),
10928+
intoType: reflect.TypeOf(float32(0)),
1092910929
want: float32(-4.1),
1093010930
},
1093110931
{
1093210932
name: "FloatPrecisionKept float64 precise",
1093310933
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1093410934
in: mustHexDecode("fbc010666666666666"),
10935-
intoType: reflect.TypeFor[any](),
10935+
intoType: reflect.TypeOf((*any)(nil)).Elem(),
1093610936
want: float64(-4.1),
1093710937
}, {
1093810938
name: "FloatPrecisionKept float64 precise 2",
1093910939
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1094010940
in: mustHexDecode("fb3ff199999999999a"),
10941-
intoType: reflect.TypeFor[any](),
10941+
intoType: reflect.TypeOf((*any)(nil)).Elem(),
1094210942
want: float64(1.1),
1094310943
},
1094410944
{
1094510945
name: "FloatPrecisionKept float32 precise",
1094610946
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1094710947
in: mustHexDecode("fb3ff8000000000000"),
10948-
intoType: reflect.TypeFor[float32](),
10948+
intoType: reflect.TypeOf(float32(0)),
1094910949
want: float32(1.5),
1095010950
},
1095110951
{
1095210952
name: "FloatPrecisionKept float32 precise 2",
1095310953
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1095410954
in: mustHexDecode("fb3ff8000000000000"),
10955-
intoType: reflect.TypeFor[float64](),
10955+
intoType: reflect.TypeOf(float64(0)),
1095610956
want: float64(1.5),
1095710957
},
1095810958
{
1095910959
name: "FloatPrecisionIgnored float64 precise",
1096010960
opts: DecOptions{FloatPrecision: FloatPrecisionIgnored},
1096110961
in: mustHexDecode("fbc010666666666666"),
10962-
intoType: reflect.TypeFor[any](),
10962+
intoType: reflect.TypeOf((*any)(nil)).Elem(),
1096310963
want: float64(-4.1),
1096410964
},
1096510965
{
1096610966
name: "FloatPrecisionKept float32 err",
1096710967
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1096810968
in: mustHexDecode("fbc010666666666666"),
10969-
intoType: reflect.TypeFor[float32](),
10969+
intoType: reflect.TypeOf(float32(0)),
1097010970
shouldErr: true,
1097110971
},
1097210972
{
1097310973
name: "FloatPrecisionKept float32 inf",
1097410974
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1097510975
in: mustHexDecode("fb7ff0000000000000"),
10976-
intoType: reflect.TypeFor[float32](),
10976+
intoType: reflect.TypeOf(float32(0)),
1097710977
want: float32(math.Inf(1)),
1097810978
}, {
1097910979
name: "FloatPrecisionKept float32 NaN",
1098010980
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1098110981
in: mustHexDecode("fb7ff8000000000000"),
10982-
intoType: reflect.TypeFor[float32](),
10982+
intoType: reflect.TypeOf(float32(0)),
1098310983
// want: float32(math.NaN()),
1098410984
shouldErr: true,
1098510985
}, {
1098610986
name: "FloatPrecisionKept float32 signal NaN",
1098710987
opts: DecOptions{FloatPrecision: FloatPrecisionKept},
1098810988
in: mustHexDecode("fb7ff8000000000001"),
10989-
intoType: reflect.TypeFor[float32](),
10989+
intoType: reflect.TypeOf(float32(0)),
1099010990
shouldErr: true,
1099110991
},
1099210992
} {
@@ -11004,10 +11004,8 @@ func TestFloatPrecisionMode(t *testing.T) {
1100411004
}
1100511005
// It should err and it did, done here
1100611006
return
11007-
} else {
11008-
if err != nil {
11009-
t.Fatal(err)
11010-
}
11007+
} else if err != nil {
11008+
t.Fatal(err)
1101111009
}
1101211010

1101311011
got := gotrv.Elem().Interface()

0 commit comments

Comments
 (0)