Skip to content
Myr

optimize code and reduce code cyclomatic complexity (#2737)

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

* optimize code and reduce code cyclomatic complexity * optimize if-condtion

authored by tyltr · committed by GitHub · parent 97a32b1 · Browse files · 2 files+4 added−8 removed
This commit

State

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

Trailers

  • Co-authored-by: thinkerou <thinkerou@gmail.com>

Diff stats

2 files+4 added−8 removed

  • other:+4 added−8 removed

2 files+4 added−8 removed

modified:binding/form.go+2 added-4 removed
20 unmodified lines
21func (formBinding) Bind(req *http.Request, obj interface{}) error {22 if err := req.ParseForm(); err != nil {23 return err24 }25 if err := req.ParseMultipartForm(defaultMemory); err != nil {26 if err != http.ErrNotMultipart {27 return err28 }25 if err := req.ParseMultipartForm(defaultMemory); err != nil && err != http.ErrNotMultipart {26 return err27 }28 if err := mapForm(obj, req.Form); err != nil {29 return err30 }
31 unmodified lines
modified:debug.go+2 added-4 removed
93 unmodified lines
94`)95}9697func debugPrintError(err error) {98 if err != nil {99 if IsDebugging() {100 fmt.Fprintf(DefaultErrorWriter, "[GIN-debug] [ERROR] %v\n", err)98 if err != nil && IsDebugging() {99 fmt.Fprintf(DefaultErrorWriter, "[GIN-debug] [ERROR] %v\n", err)101 }100 }101}