From d4757efc68ed966472de0eb35879d805872165e0 Mon Sep 17 00:00:00 2001 From: Daniel Kang Date: Thu, 17 Jan 2019 16:51:00 -0800 Subject: [PATCH] use 'strconv.Quote()` instead of string formatter --- objects/string.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/objects/string.go b/objects/string.go index c95de59..67d5ddd 100644 --- a/objects/string.go +++ b/objects/string.go @@ -1,7 +1,7 @@ package objects import ( - "fmt" + "strconv" "github.com/d5/tengo/compiler/token" ) @@ -17,7 +17,7 @@ func (o *String) TypeName() string { } func (o *String) String() string { - return fmt.Sprintf("%q", o.Value) + return strconv.Quote(o.Value) } // BinaryOp returns another object that is the result of