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

fix: partial eval misusing Token.Bytes slice #379

Merged
merged 14 commits into from
Jun 7, 2022
Merged

fix: partial eval misusing Token.Bytes slice #379

merged 14 commits into from
Jun 7, 2022

Conversation

i4ki
Copy link
Contributor

@i4ki i4ki commented Jun 3, 2022

The code modified the *hclwrite.Token.Bytes slice directly but it seems that multiple Hashicorp tokens can have its bytes backed by the same byte array, so appending bytes to tok.Bytes was overwriting the byte slice of other tokens.

Closes #376

@i4ki i4ki marked this pull request as draft June 3, 2022 12:24
@i4ki i4ki changed the title chore: reproduce issue chore: reproduce partial evaluation issue Jun 3, 2022
@i4ki i4ki changed the title chore: reproduce partial evaluation issue fix: partial eval misusing Token.Bytes slice Jun 3, 2022
@codecov
Copy link

codecov bot commented Jun 3, 2022

Codecov Report

Merging #379 (6f4df40) into main (2358a7b) will increase coverage by 0.04%.
The diff coverage is 92.85%.

@@            Coverage Diff             @@
##             main     #379      +/-   ##
==========================================
+ Coverage   69.30%   69.34%   +0.04%     
==========================================
  Files          37       37              
  Lines        7300     7318      +18     
==========================================
+ Hits         5059     5075      +16     
- Misses       1981     1982       +1     
- Partials      260      261       +1     
Flag Coverage Δ
tests 69.34% <92.85%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
hcl/eval/partial.go 80.49% <92.85%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2358a7b...6f4df40. Read the comment docs.

@i4ki i4ki marked this pull request as ready for review June 5, 2022 14:19
katcipis
katcipis previously approved these changes Jun 7, 2022
Copy link
Contributor

@katcipis katcipis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM + some small considerations if we should test stack path related things on the genhcl package, but not sure about it, feel free to disregard.

@i4ki i4ki merged commit 9b30317 into main Jun 7, 2022
@i4ki i4ki deleted the i4k-fix-issue-376 branch June 7, 2022 13:08
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 this pull request may close these issues.

[BUG] Codegeneration provides inccorrect code
2 participants