Merge pull request #27440 from hashicorp/alisdair/fix-rendering-of-long-integers

cli: Fix rendering of long integers
This commit is contained in:
Alisdair McDiarmid 2021-01-12 10:06:40 -05:00 committed by GitHub
commit f5785b43c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -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"

View File

@ -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`,