Skip to content

Commit

Permalink
use errors.New to replace fmt.Errorf will much better
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2d3c committed Apr 27, 2021
1 parent c0418c4 commit 0c266f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions binding/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package binding

import (
"bytes"
"fmt"
"errors"
"io"
"net/http"

Expand All @@ -32,7 +32,7 @@ func (jsonBinding) Name() string {

func (jsonBinding) Bind(req *http.Request, obj interface{}) error {
if req == nil || req.Body == nil {
return fmt.Errorf("invalid request")
return errors.New("invalid request")
}
return decodeJSON(req.Body, obj)
}
Expand Down

0 comments on commit 0c266f9

Please sign in to comment.