From 921eeab75a87d07eaf9cec57dcdc8a3c276f291a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 14 Feb 2023 11:01:17 -0700 Subject: compat/json: Use fastio.Discard instead of io.Discard --- compat/json/compat.go | 3 ++- compat/json/testcompat_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compat/json/compat.go b/compat/json/compat.go index c96470d..0b86732 100644 --- a/compat/json/compat.go +++ b/compat/json/compat.go @@ -15,6 +15,7 @@ import ( "strconv" "git.lukeshu.com/go/lowmemjson" + "git.lukeshu.com/go/lowmemjson/internal/fastio" ) //nolint:stylecheck // ST1021 False positive; these aren't comments on individual types. @@ -172,7 +173,7 @@ func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error { } func Valid(data []byte) bool { - formatter := lowmemjson.NewReEncoder(io.Discard, lowmemjson.ReEncoderConfig{ + formatter := lowmemjson.NewReEncoder(fastio.Discard, lowmemjson.ReEncoderConfig{ Compact: true, }) _, err := formatter.Write(data) diff --git a/compat/json/testcompat_test.go b/compat/json/testcompat_test.go index 42cbf5c..c186678 100644 --- a/compat/json/testcompat_test.go +++ b/compat/json/testcompat_test.go @@ -7,10 +7,10 @@ package json import ( "bytes" "encoding/json" - "io" _ "unsafe" "git.lukeshu.com/go/lowmemjson" + "git.lukeshu.com/go/lowmemjson/internal/fastio" "git.lukeshu.com/go/lowmemjson/internal/jsonparse" "git.lukeshu.com/go/lowmemjson/internal/jsonstring" "git.lukeshu.com/go/lowmemjson/internal/jsonstruct" @@ -25,7 +25,7 @@ var ( type scanner = lowmemjson.ReEncoderConfig func checkValid(in []byte, scan *lowmemjson.ReEncoderConfig) error { - return reencode(io.Discard, in, *scan) + return reencode(fastio.Discard, in, *scan) } func isValidNumber(s string) bool { -- cgit v1.1-4-g5e80