hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
375 stars 64 forks source link

hclwrite: fix space being added between interpolated items #77

Closed acburdine closed 5 years ago

acburdine commented 5 years ago

closes #65

codecov-io commented 5 years ago

Codecov Report

Merging #77 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #77      +/-   ##
==========================================
+ Coverage   65.74%   65.75%   +<.01%     
==========================================
  Files          97       97              
  Lines       10241    10243       +2     
==========================================
+ Hits         6733     6735       +2     
  Misses       3179     3179              
  Partials      329      329
Impacted Files Coverage Δ
hclwrite/format.go 93.56% <100%> (+0.05%) :arrow_up:

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 40e962e...c110354. Read the comment docs.

apparentlymart commented 5 years ago

Thanks so much for working on this, @acburdine! I was about to dive into this myself, so I was pleasantly surprised to find this PR here when I went to look at #65!

I had expected that we'd need to make an exception where we suspend processing of spaces between TokenOQuote and TokenCQuote, but in retrospect what you did here makes sense and is much more straightforward, since we know that the only other token types that can come before or after interpolation sequences are TokenOQuote, TokenCQuote, and TokenQuotedLiteral.

This will also allow us to close out hashicorp/terraform#19744 once we update the vendored version of HCL2 to include this change.