From c5994a8b28d7d2877d14455759a4166a87069174 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Fri, 11 Nov 2022 09:50:22 +1100 Subject: [PATCH] Simplified json error check --- pkg/yqlib/encoder.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/yqlib/encoder.go b/pkg/yqlib/encoder.go index d050c84a..e9fae6af 100644 --- a/pkg/yqlib/encoder.go +++ b/pkg/yqlib/encoder.go @@ -45,11 +45,7 @@ func (o *orderedMap) UnmarshalJSON(data []byte) error { // cycle through k/v var tok json.Token - for tok, err = dec.Token(); !errors.Is(err, io.EOF); tok, err = dec.Token() { - if err != nil && !errors.Is(err, io.EOF) { - return err - } - + for tok, err = dec.Token(); err == nil; tok, err = dec.Token() { // we can expect two types: string or Delim. Delim automatically means // that it is the closing bracket of the object, whereas string means // that there is another key.