Skip to content

Commit

Permalink
Merge pull request #51 from abdullah-alaadine/master
Browse files Browse the repository at this point in the history
refactor: replace deprecated io/ioutil usage with io package
  • Loading branch information
pkieltyka authored Oct 15, 2023
2 parents c196354 + 814d8a6 commit 14f1cb3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/xml"
"errors"
"io"
"io/ioutil"
"net/http"

"github.com/ajg/form"
Expand Down Expand Up @@ -40,13 +39,13 @@ func DefaultDecoder(r *http.Request, v interface{}) error {

// DecodeJSON decodes a given reader into an interface using the json decoder.
func DecodeJSON(r io.Reader, v interface{}) error {
defer io.Copy(ioutil.Discard, r) //nolint:errcheck
defer io.Copy(io.Discard, r) //nolint:errcheck
return json.NewDecoder(r).Decode(v)
}

// DecodeXML decodes a given reader into an interface using the xml decoder.
func DecodeXML(r io.Reader, v interface{}) error {
defer io.Copy(ioutil.Discard, r) //nolint:errcheck
defer io.Copy(io.Discard, r) //nolint:errcheck
return xml.NewDecoder(r).Decode(v)
}

Expand Down

0 comments on commit 14f1cb3

Please sign in to comment.