use errors.New to replace fmt.Errorf will much better (#2707)

This commit is contained in:
Qt 2021-04-28 18:39:09 +08:00 committed by GitHub
parent c0418c48e4
commit 215c9ce231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ package binding
import (
"bytes"
"fmt"
"errors"
"io"
"net/http"
@ -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)
}