From 211aba39c8ddc81912160caa0edea2d61555efef Mon Sep 17 00:00:00 2001 From: dmathieu <42@dmathieu.com> Date: Tue, 25 Jul 2017 09:39:35 +0200 Subject: [PATCH] use buffer length to avoid generating strings every time --- text_formatter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text_formatter.go b/text_formatter.go index ec8d473..79239cf 100644 --- a/text_formatter.go +++ b/text_formatter.go @@ -154,7 +154,7 @@ func (f *TextFormatter) needsQuoting(text string) bool { } func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { - if b.String() != "" { + if b.Len() > 0 { b.WriteByte(' ') } b.WriteString(key)