diff options
author | Luke Shumaker <lukeshu@datawire.io> | 2022-08-30 01:36:46 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@datawire.io> | 2022-08-30 01:36:46 -0600 |
commit | 8cf459090af5a4e5db0f8c9a4ac21667029f8639 (patch) | |
tree | 5e4e38582eaa2a4e4df72bb37548eb6d1764d47d /encode.go | |
parent | 325838f35ce90080aa6c892a998d960c06c1c144 (diff) |
Allow calling lowmemjson.Encode at the root of EncodeJSON
Diffstat (limited to 'encode.go')
-rw-r--r-- | encode.go | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -9,8 +9,10 @@ import ( "encoding" "encoding/base64" "encoding/json" + "errors" "fmt" "io" + iofs "io/fs" "reflect" "sort" "strconv" @@ -130,7 +132,7 @@ func encode(w io.Writer, val reflect.Value, escaper BackslashEscaper, quote bool SourceFunc: "EncodeJSON", }}) } - if err := validator.Close(); err != nil { + if err := validator.Close(); err != nil && !errors.Is(err, iofs.ErrClosed) { panic(encodeError{err}) } |