Skip to content

Commit

Permalink
Gin1.5 bytes.Buffer to strings.Builder (#1939)
Browse files Browse the repository at this point in the history
* Replace bytes.Buffer to strings.Builder

* Merge the latest changes

* Update errors.go
  • Loading branch information
guonaihong authored and thinkerou committed Jun 29, 2019
1 parent 3f53a58 commit b67bc8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package gin

import (
"bytes"
"fmt"
"html/template"
"runtime"
Expand Down Expand Up @@ -38,7 +37,7 @@ func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) {

func debugPrintLoadTemplate(tmpl *template.Template) {
if IsDebugging() {
var buf bytes.Buffer
var buf strings.Builder
for _, tmpl := range tmpl.Templates() {
buf.WriteString("\t- ")
buf.WriteString(tmpl.Name())
Expand Down
4 changes: 2 additions & 2 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
package gin

import (
"bytes"
"fmt"
"reflect"
"strings"

"github.com/gin-gonic/gin/internal/json"
)
Expand Down Expand Up @@ -158,7 +158,7 @@ func (a errorMsgs) String() string {
if len(a) == 0 {
return ""
}
var buffer bytes.Buffer
var buffer strings.Builder
for i, msg := range a {
fmt.Fprintf(&buffer, "Error #%02d: %s\n", i+1, msg.Err)
if msg.Meta != nil {
Expand Down

0 comments on commit b67bc8f

Please sign in to comment.