Skip to content

Commit

Permalink
json: minor cleanups: ioutil.ReadAll->io.ReadAll
Browse files Browse the repository at this point in the history
Also, move the close-brace for the empty Decoder struct onto the same
line as the open-brace.
  • Loading branch information
dfinkel committed May 17, 2024
1 parent 42a61b7 commit 7c8d66f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions decoders/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"reflect"

"github.com/vimeo/dials"
Expand All @@ -17,13 +16,12 @@ import (
const JSONTagName = "json"

// Decoder is a decoder that knows how to work with text encoded in JSON
type Decoder struct {
}
type Decoder struct{}

// Decode is a decoder that decodes the JSON from an io.Reader into the
// appropriate struct.
func (d *Decoder) Decode(r io.Reader, t *dials.Type) (reflect.Value, error) {
jsonBytes, err := ioutil.ReadAll(r)
jsonBytes, err := io.ReadAll(r)
if err != nil {
return reflect.Value{}, fmt.Errorf("error reading JSON: %s", err)
}
Expand Down

0 comments on commit 7c8d66f

Please sign in to comment.