Skip to content
Myr

Gin1.5 bytes.Buffer to strings.Builder (#1939)

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

* Replace bytes.Buffer to strings.Builder * Merge the latest changes * Update errors.go

authored by guonaihong · committed by thinkerou · parent 3f53a58 · Browse files · 2 files+3 added−4 removed
This commit

State

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

Diff stats

2 files+3 added−4 removed

  • other:+3 added−4 removed

2 files+3 added−4 removed

modified:debug.go+1 added-2 removed
3 unmodified lines
45package gin67import (8 "bytes"8 "fmt"9 "html/template"10 "runtime"11 "strconv"
24 unmodified lines
36}3738func debugPrintLoadTemplate(tmpl *template.Template) {39 if IsDebugging() {41 var buf bytes.Buffer40 var buf strings.Builder41 for _, tmpl := range tmpl.Templates() {42 buf.WriteString("\t- ")43 buf.WriteString(tmpl.Name())44 buf.WriteString("\n")
59 unmodified lines
modified:errors.go+2 added-2 removed
3 unmodified lines
45package gin67import (8 "bytes"8 "fmt"9 "reflect"10 "strings"1112 "github.com/gin-gonic/gin/internal/json"13)14
142 unmodified lines
157func (a errorMsgs) String() string {158 if len(a) == 0 {159 return ""160 }161 var buffer bytes.Buffer161 var buffer strings.Builder162 for i, msg := range a {163 fmt.Fprintf(&buffer, "Error #%02d: %s\n", i+1, msg.Err)164 if msg.Meta != nil {165 fmt.Fprintf(&buffer, " Meta: %v\n", msg.Meta)
4 unmodified lines