use 'strconv.Quote()` instead of string formatter

This commit is contained in:
Daniel Kang 2019-01-17 16:51:00 -08:00
parent f145261e85
commit d4757efc68

View file

@ -1,7 +1,7 @@
package objects package objects
import ( import (
"fmt" "strconv"
"github.com/d5/tengo/compiler/token" "github.com/d5/tengo/compiler/token"
) )
@ -17,7 +17,7 @@ func (o *String) TypeName() string {
} }
func (o *String) String() 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 // BinaryOp returns another object that is the result of