From ee7359a6413597b5cc8d3bb95159b3fa30fd155e Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 4 Nov 2017 18:58:48 +0300 Subject: [PATCH] cleanup --- parse.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/parse.go b/parse.go index 4ad9386..9e4c9ba 100644 --- a/parse.go +++ b/parse.go @@ -118,13 +118,18 @@ type listExpr struct { } func (e *listExpr) String() string { - buf := []byte{':', '{', '{', ' '} + var buf bytes.Buffer + + buf.WriteString(":{{ ") + for _, expr := range e.exprs { - buf = append(buf, expr.String()...) - buf = append(buf, ';', ' ') + buf.WriteString(expr.String()) + buf.WriteString("; ") } - buf = append(buf, '}', '}') - return string(buf) + + buf.WriteString("}}") + + return buf.String() } type parser struct {