aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-03-16 12:38:51 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-03-16 12:38:51 +0100
commitb785eacf2037dd119fae1e6077c799e5c7a77883 (patch)
tree5f49dbc9026de5c361654cebccf4ac362a874988
parent71056896ac6c963f8590795e1d41b2dd679025b9 (diff)
downloadell-master.tar.gz
ell-master.tar.xz
ell-master.zip
Go: fix string formatting in error messagesHEADorigin/mastermaster
-rw-r--r--ell/stdlib.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/ell/stdlib.go b/ell/stdlib.go
index 4a8889f..0c98287 100644
--- a/ell/stdlib.go
+++ b/ell/stdlib.go
@@ -280,7 +280,7 @@ func fnMinus(ell *Ell, args []V) (result []V, ok bool) {
var res float64
if n, _ := fmt.Sscan(args[0].String, &res); n < 1 {
- return ell.Errorf("invalid number: %f", args[0].String)
+ return ell.Errorf("invalid number: %s", args[0].String)
}
if len(args) == 1 {
res = -res
@@ -292,7 +292,7 @@ func fnMinus(ell *Ell, args []V) (result []V, ok bool) {
}
var value float64
if n, _ := fmt.Sscan(arg.String, &value); n < 1 {
- return ell.Errorf("invalid number: %f", arg.String)
+ return ell.Errorf("invalid number: %s", arg.String)
}
res -= value
}
@@ -321,7 +321,7 @@ func fnDivide(ell *Ell, args []V) (result []V, ok bool) {
var res float64
if n, _ := fmt.Sscan(args[0].String, &res); n < 1 {
- return ell.Errorf("invalid number: %f", args[0].String)
+ return ell.Errorf("invalid number: %s", args[0].String)
}
for _, arg := range args[1:] {
if arg.Type != VTypeString {
@@ -329,7 +329,7 @@ func fnDivide(ell *Ell, args []V) (result []V, ok bool) {
}
var value float64
if n, _ := fmt.Sscan(arg.String, &value); n < 1 {
- return ell.Errorf("invalid number: %f", arg.String)
+ return ell.Errorf("invalid number: %s", arg.String)
}
res /= value
}
@@ -411,7 +411,7 @@ func fnEquals(ell *Ell, args []V) (result []V, ok bool) {
}
var first, second float64
if n, _ := fmt.Sscan(args[0].String, &first); n < 1 {
- return ell.Errorf("invalid number: %f", args[0].String)
+ return ell.Errorf("invalid number: %s", args[0].String)
}
res := true
for _, arg := range args[1:] {
@@ -419,7 +419,7 @@ func fnEquals(ell *Ell, args []V) (result []V, ok bool) {
return ell.Errorf("arguments must be strings")
}
if n, _ := fmt.Sscan(arg.String, &second); n < 1 {
- return ell.Errorf("invalid number: %f", arg.String)
+ return ell.Errorf("invalid number: %s", arg.String)
}
if res = first == second; !res {
break
@@ -435,7 +435,7 @@ func fnLess(ell *Ell, args []V) (result []V, ok bool) {
}
var first, second float64
if n, _ := fmt.Sscan(args[0].String, &first); n < 1 {
- return ell.Errorf("invalid number: %f", args[0].String)
+ return ell.Errorf("invalid number: %s", args[0].String)
}
res := true
for _, arg := range args[1:] {
@@ -443,7 +443,7 @@ func fnLess(ell *Ell, args []V) (result []V, ok bool) {
return ell.Errorf("arguments must be strings")
}
if n, _ := fmt.Sscan(arg.String, &second); n < 1 {
- return ell.Errorf("invalid number: %f", arg.String)
+ return ell.Errorf("invalid number: %s", arg.String)
}
if res = first < second; !res {
break