hcl icon indicating copy to clipboard operation
hcl copied to clipboard

Decode into slice reuses element data between len and cap

Open invidian opened this issue 5 years ago • 0 comments

#306 added logic to retain blocks when decoding, which allows nice handling of default values. However, when creating #306, I wasn't aware of golang/go#21092. TL;DR when decoding slices, all elements should be reset instead of merged, to avoid confusion about created data structures. Currently HCL decoder follows the same behavior as encoding/json. Perhaps this could be fixed in HCL faster than in JSON decoder, but I'm not sure about this.

References

Are there any other GitHub issues (open or closed) that should be linked here? For example:

  • #306

invidian avatar Jan 15 '20 13:01 invidian