Simplified json error check

This commit is contained in:
Mike Farah 2022-11-11 09:50:22 +11:00
parent 3435fee1f9
commit c5994a8b28

View File

@ -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.