vm: fix linter warning

Fix the following linter warning:
```
indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (revive)
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-10-20 17:22:21 +03:00
parent 890f64007a
commit 39ce3a9d1d

View file

@ -184,13 +184,15 @@ func FromJSON(data []byte, maxCount int, bestIntPrecision bool) (Item, error) {
bestIntPrecision: bestIntPrecision, bestIntPrecision: bestIntPrecision,
} }
d.UseNumber() d.UseNumber()
if item, err := d.decode(); err != nil { item, err := d.decode()
if err != nil {
return nil, err return nil, err
} else if _, err := d.Token(); !errors.Is(err, gio.EOF) {
return nil, fmt.Errorf("%w: unexpected items", ErrInvalidValue)
} else {
return item, nil
} }
_, err = d.Token()
if !errors.Is(err, gio.EOF) {
return nil, fmt.Errorf("%w: unexpected items", ErrInvalidValue)
}
return item, nil
} }
func (d *decoder) decode() (Item, error) { func (d *decoder) decode() (Item, error) {