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

Consider running tests with -race flag #145

Closed
TomerHeber opened this issue Jun 6, 2022 · 2 comments
Closed

Consider running tests with -race flag #145

TomerHeber opened this issue Jun 6, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@TomerHeber
Copy link
Collaborator

This is a follow-up to #143.
Issues were discovered when running tests with this flag. It may be a good idea to enable this flag to detect race conditions.
However, at the moment there seems to be an issue when using this flag.

WARNING: DATA RACE
Write at 0x00000279f420 by goroutine 126:
  github.com/hashicorp/hcl/v2/hclwrite.formatSpaces()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/format.go:127 +0x29d
  github.com/hashicorp/hcl/v2/hclwrite.format()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/format.go:36 +0x6c
  github.com/hashicorp/hcl/v2/hclwrite.TokensForValue()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/generate.go:25 +0x8a
  github.com/hashicorp/hcl/v2/hclwrite.NewExpressionLiteral()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/ast_expression.go:61 +0x97
  github.com/hashicorp/hcl/v2/hclwrite.(*Body).SetAttributeValue()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/ast_body.go:167 +0x23d
  github.com/env0/terratag/internal/convert.AppendTagBlocks()
      /Users/theber/code/terratag/internal/convert/convert.go:153 +0x93a
  github.com/env0/terratag/internal/tagging.tagAutoscalingGroup()
      /Users/theber/code/terratag/internal/tagging/aws.go:9 +0x38
  github.com/env0/terratag/internal/tagging.TagResource()
      /Users/theber/code/terratag/internal/tagging/tagging.go:67 +0x157
  github.com/env0/terratag.tagFileResources()
      /Users/theber/code/terratag/terratag.go:147 +0xba4
  github.com/env0/terratag.tagDirectoryResources.func1()
      /Users/theber/code/terratag/terratag.go:86 +0x1e4
  github.com/env0/terratag.tagDirectoryResources.func2()
      /Users/theber/code/terratag/terratag.go:93 +0x58

Previous write at 0x00000279f420 by goroutine 100:
  github.com/hashicorp/hcl/v2/hclwrite.formatSpaces()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/format.go:127 +0x29d
  github.com/hashicorp/hcl/v2/hclwrite.format()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/format.go:36 +0x6c
  github.com/hashicorp/hcl/v2/hclwrite.TokensForValue()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/generate.go:25 +0x8a
  github.com/hashicorp/hcl/v2/hclwrite.NewExpressionLiteral()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/ast_expression.go:61 +0x97
  github.com/hashicorp/hcl/v2/hclwrite.(*Body).SetAttributeValue()
      /Users/theber/go/pkg/mod/github.com/hashicorp/hcl/v2@v2.8.0/hclwrite/ast_body.go:167 +0x23d
  github.com/env0/terratag/internal/convert.AppendLocalsBlock()
      /Users/theber/code/terratag/internal/convert/convert.go:141 +0xd9b
  github.com/env0/terratag.tagFileResources()
      /Users/theber/code/terratag/terratag.go:185 +0xdbd
  github.com/env0/terratag.tagDirectoryResources.func1()
      /Users/theber/code/terratag/terratag.go:86 +0x1e4
  github.com/env0/terratag.tagDirectoryResources.func2()
      /Users/theber/code/terratag/terratag.go:93 +0x58

I have reached out to HCL about this issue.
hashicorp/hcl#533

@TomerHeber TomerHeber added the enhancement New feature or request label Jun 6, 2022
@TomerHeber
Copy link
Collaborator Author

The issue has been fixed in HCL.
The next release should contain the fix.

@yaronya
Copy link
Contributor

yaronya commented Oct 13, 2022

@TomerHeber I'm closing this one, feel free to re-open if you find it still relevant.

@yaronya yaronya closed this as completed Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants