Skip to content

Fix type conversion for numbers #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 24, 2020
Merged

Conversation

khos2ow
Copy link
Member

@khos2ow khos2ow commented Feb 20, 2020

Prerequisites

Put an x into the box(es) that apply:

  • This pull request fixes a bug.
  • This pull request adds a feature.
  • This pull request enhances existing functionality.
  • This pull request introduces breaking change.

For more information, see the Contributing Guide.

Description

This PR fixes a regression added in #196. There seems to be a discrepancy of how "number" variables are processed (what we observed up to now the numbers on darwin are being treated as int but in linux they are float64, this yet to be validated). So instead we are going to explicitly convert all types of numbers (int, in8, int16, ...) to float64.

Issues Resolved

Fixes #203

Checklist

Put an x into all boxes that apply:

Tests

  • I have added tests to cover my changes.
  • All tests pass when I run make test.

Documentation

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Code Style

  • My code follows the code style of this project.

@khos2ow khos2ow added this to the v0.9.0 milestone Feb 20, 2020
@khos2ow
Copy link
Member Author

khos2ow commented Feb 20, 2020

@mgtrrz @apriljo I've opened this as an interim but still haven't been able to test it myself on a Mac to completely rule that out. I'd appreciate it if you could pull this down and test it on your side against your full configuration.

@apriljo
Copy link

apriljo commented Feb 20, 2020

Seems to work.

❯ git fetch origin pull/204/head:fix-number
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 14 (delta 1), reused 7 (delta 1), pack-reused 0
Unpacking objects: 100% (14/14), done.
From https://github.com/segmentio/terraform-docs
 * [new ref]         refs/pull/204/head -> fix-number
❯ git checkout fix-number
Switched to branch 'fix-number'
❯ make build && ./bin/darwin-amd64/terraform-docs --version
==> Clean workspace
rm -rf ./bin
==> Build binary for current OS/ARCH
CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -ldflags " -X github.com/segmentio/terraform-docs/internal/version.version=v0.8.2-18-gaed5126 -X github.com/segmentio/terraform-docs/internal/version.commitHash=aed5126 -X github.com/segmentio/terraform-docs/internal/version.buildDate=2020-02-20T15:59:56-0500 " -o ./bin/darwin-amd64/terraform-docs
terraform-docs version v0.8.2-18-gaed5126 darwin/amd64 BuildDate: 2020-02-20T15:59:56-0500
❯ ./bin/darwin-amd64/terraform-docs markdown table april
## Providers

No provider.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| number | the number | `number` | `42` | no |

## Outputs

| Name | Description |
|------|-------------|
| module\_number | the module number, defaults ${var.number} |
❯ cat april/*
variable "number" {
  description = "the number"
  default = 42
}

output "module_number" {
  description = "the module number, defaults ${var.number}"
  value = "${var.number}"
}

@khos2ow khos2ow marked this pull request as ready for review February 24, 2020 15:15
@khos2ow khos2ow merged commit f55fd6c into terraform-docs:master Feb 24, 2020
@khos2ow khos2ow deleted the fix-number branch February 24, 2020 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go panic: interface conversion with v0.9.0-alpha release
2 participants