From e4ed4a9b8b0427330d30976a0afb63232c37eecb Mon Sep 17 00:00:00 2001 From: Developer Date: Thu, 4 Jun 2026 03:39:57 +0000 Subject: [PATCH] refactor: replace interface{} with any (Go 1.18+) --- README.md | 2 +- fuzz.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9531e08..bcd9e68 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ BenchmarkDecoderNextToken/pkgjson/sample.json.gz-16 2032 BenchmarkDecoderNextToken/encodingjson/sample.json.gz-16 332 3574484 ns/op 192.33 MB/s 759685 B/op 26643 allocs/op ``` -Decoding into an `interface{}` this package is 40-50% faster than `encoding/json`: +Decoding into an `any` this package is 40-50% faster than `encoding/json`: ``` BenchmarkDecoderDecodeInterfaceAny/pkgjson/canada.json.gz-16 43 27181309 ns/op 82.82 MB/s 8747225 B/op 281408 allocs/op BenchmarkDecoderDecodeInterfaceAny/encodingjson/canada.json.gz-16 30 36930290 ns/op 60.95 MB/s 20647699 B/op 392553 allocs/op diff --git a/fuzz.go b/fuzz.go index 9acebc6..8a724f6 100644 --- a/fuzz.go +++ b/fuzz.go @@ -31,7 +31,7 @@ func Fuzz(data []byte) int { } return 0 } - var i interface{} + var i any dec = NewDecoder(bytes.NewReader(data)) err := dec.Decode(&i) if err != nil {