hashicorp / hashicorp/hcl

Decode into slice reuses element data between len and cap

Open
#336 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

#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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the slice-decoding changes from #306 and comparing the current behavior with Go's encoding/json decoder. Confirm that decoding resets every slice element instead of merging retained data; the issue provides no specific files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.