summaryrefslogtreecommitdiff
path: root/encode.go
diff options
context:
space:
mode:
Diffstat (limited to 'encode.go')
-rw-r--r--encode.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/encode.go b/encode.go
index f93cba4..acef214 100644
--- a/encode.go
+++ b/encode.go
@@ -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})
}