Skip to content
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

Multiple Go format verbs on one line are not handled by fmtcompat #30

Closed
gdavison opened this issue Aug 18, 2020 · 0 comments · Fixed by #31
Closed

Multiple Go format verbs on one line are not handled by fmtcompat #30

gdavison opened this issue Aug 18, 2020 · 0 comments · Fixed by #31
Milestone

Comments

@gdavison
Copy link
Contributor

gdavison commented Aug 18, 2020

When handling Terraform blocks in Go files, when a line contains more than one Go format verb, the --fmtcompat flag does not replace any of the flags.

Example 1

provider "aws" {
  ignore_tags {
    keys = [%[1]q, %[2]q]
  }

  skip_credentials_validation = true
  skip_get_ec2_platforms      = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true
}

Expected

ignore_tags {
  keys = ["@@_@@ TFMT:%[1]q:TFMT @@_@@", "@@_@@ TFMT:%[2]q:TFMT @@_@@"]
}

Got

ignore_tags {
  keys = [%[1]q, %[2]q]
}

Example 2

resource "aws_accessanalyzer_analyzer" "test" {
  analyzer_name = %[1]q

  tags = {
    %[2]q = %[3]q
  }
}

Expected

tags = {
  "@@_@@ TFMT:%[2]q:TFMT @@_@@" = "@@_@@ TFMT:%[3]q:TFMT @@_@@"
}

Got

tags = {
  %[2]q = "@@_@@ TFMT:%[3]q:TFMT @@_@@"
}

Needed for hashicorp/terraform-provider-aws#14722

@katbyte katbyte added this to the v0.3.0 milestone Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants