diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-14 11:01:17 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-16 22:56:05 -0700 |
commit | 921eeab75a87d07eaf9cec57dcdc8a3c276f291a (patch) | |
tree | d470c51dafcf529462f12313b55aeae9d7e18177 /compat | |
parent | debef01cc500fb9368e1d6d0206a32ca358a8c98 (diff) |
compat/json: Use fastio.Discard instead of io.Discard
Diffstat (limited to 'compat')
-rw-r--r-- | compat/json/compat.go | 3 | ||||
-rw-r--r-- | 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 { |