Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Qt · committed by GitHub · parent c0418c4 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:binding/json.go+2 added-2 removed
4 unmodified lines
5package binding67import (8 "bytes"9 "fmt"9 "errors"10 "io"11 "net/http"1213 "github.com/gin-gonic/gin/internal/json"
17 unmodified lines
31}3233func (jsonBinding) Bind(req *http.Request, obj interface{}) error {34 if req == nil || req.Body == nil {35 return fmt.Errorf("invalid request")35 return errors.New("invalid request")36 }37 return decodeJSON(req.Body, obj)38}39
17 unmodified lines