truncation of trailing zeros
Houlistonm opened this issue · comments
Mark Houliston commented
me@myhost:~$ gojo -v
gojo 0.3.1 (rev: 4b41259/go1.19)
me@myhost:~$ gojo a=1 b=1.0 c=1.10 d=1.2.0 e=1.2.10
{"a":1,"b":1,"c":1.1,"d":"1.2.0","e":"1.2.10"}
These are all version strings in our system.
Trailing zeros are dropped when there is exactly one decimal point in the value (conversion to float??)
I expect element "c" to have the value 1.10
instead of 1.1
I've tried single and double quotes to rule out the bash shell.
Using gojq to create the object produces the correct result
me@myhost:~$ gojq --arg ver 1.10 -nce '{c: $ver}'
{"c":"1.10"}
itchyny commented
Try quoting to make them strings, if you think the output of gojq correct.
$ gojo a=\"1\" b=\"1.0\" c=\"1.10\"
{"a":"1","b":"1.0","c":"1.10"}
itchyny commented
Another way to avoid escape characters is gojo 'a="1"' 'b="1.0"' 'c="1.10"'
.