From d33079d0ec81721060fb0ec3163592f70190b4ca Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Tue, 7 Apr 2015 19:54:17 +0200 Subject: [PATCH] Performance improvement when writing formatted strings --- render/render.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/render/render.go b/render/render.go index 90d54971..73fe69ce 100644 --- a/render/render.go +++ b/render/render.go @@ -74,7 +74,7 @@ func (_ plainTextRender) Render(w http.ResponseWriter, code int, data ...interfa format := data[0].(string) args := data[1].([]interface{}) if len(args) > 0 { - _, err = w.Write([]byte(fmt.Sprintf(format, args...))) + _, err = fmt.Fprintf(w, format, args...) } else { _, err = w.Write([]byte(format)) } @@ -86,7 +86,7 @@ func (_ htmlPlainRender) Render(w http.ResponseWriter, code int, data ...interfa format := data[0].(string) args := data[1].([]interface{}) if len(args) > 0 { - _, err = w.Write([]byte(fmt.Sprintf(format, args...))) + _, err = fmt.Fprintf(w, format, args...) } else { _, err = w.Write([]byte(format)) }