Gin1.5 bytes.Buffer to strings.Builder (#1939)
* Replace bytes.Buffer to strings.Builder * Merge the latest changes * Update errors.go
This commit is contained in:
parent
3f53a58d4a
commit
b67bc8f005
3
debug.go
3
debug.go
@ -5,7 +5,6 @@
|
|||||||
package gin
|
package gin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -38,7 +37,7 @@ func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) {
|
|||||||
|
|
||||||
func debugPrintLoadTemplate(tmpl *template.Template) {
|
func debugPrintLoadTemplate(tmpl *template.Template) {
|
||||||
if IsDebugging() {
|
if IsDebugging() {
|
||||||
var buf bytes.Buffer
|
var buf strings.Builder
|
||||||
for _, tmpl := range tmpl.Templates() {
|
for _, tmpl := range tmpl.Templates() {
|
||||||
buf.WriteString("\t- ")
|
buf.WriteString("\t- ")
|
||||||
buf.WriteString(tmpl.Name())
|
buf.WriteString(tmpl.Name())
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
package gin
|
package gin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/json"
|
"github.com/gin-gonic/gin/internal/json"
|
||||||
)
|
)
|
||||||
@ -158,7 +158,7 @@ func (a errorMsgs) String() string {
|
|||||||
if len(a) == 0 {
|
if len(a) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
var buffer bytes.Buffer
|
var buffer strings.Builder
|
||||||
for i, msg := range a {
|
for i, msg := range a {
|
||||||
fmt.Fprintf(&buffer, "Error #%02d: %s\n", i+1, msg.Err)
|
fmt.Fprintf(&buffer, "Error #%02d: %s\n", i+1, msg.Err)
|
||||||
if msg.Meta != nil {
|
if msg.Meta != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user