mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 17:01:04 -06:00
cli: Fix rendering of long integers
Recent changes to the human-readable rendering of outputs and console values led to long integer values being presented in scientific notation (e.g. 1.2345678e+07). While technically correct, this is an unusual way to present integer values. This commit changes the formatting mode to 'f', which never uses scientific notation and displays integer values as a sequence of digits instead (e.g. 12345678).
This commit is contained in:
parent
bc46ff545e
commit
d763e4f73e
@ -52,7 +52,7 @@ func FormatValue(v cty.Value, indent int) string {
|
||||
return strconv.Quote(v.AsString())
|
||||
case cty.Number:
|
||||
bf := v.AsBigFloat()
|
||||
return bf.Text('g', -1)
|
||||
return bf.Text('f', -1)
|
||||
case cty.Bool:
|
||||
if v.True() {
|
||||
return "true"
|
||||
|
@ -89,10 +89,22 @@ EOT_`,
|
||||
cty.NumberIntVal(5),
|
||||
`5`,
|
||||
},
|
||||
{
|
||||
cty.NumberIntVal(1234567890),
|
||||
`1234567890`,
|
||||
},
|
||||
{
|
||||
cty.NumberFloatVal(5.2),
|
||||
`5.2`,
|
||||
},
|
||||
{
|
||||
cty.NumberFloatVal(123456789.0),
|
||||
`123456789`,
|
||||
},
|
||||
{
|
||||
cty.NumberFloatVal(123456789.01),
|
||||
`123456789.01`,
|
||||
},
|
||||
{
|
||||
cty.False,
|
||||
`false`,
|
||||
|
Loading…
Reference in New Issue
Block a user