Commit a1e776c
committed
Compact comment-skipping in
The previous implementation pre-allocated `result` to `len(slice)`
and wrote each non-comment value at its source index. When the input
contained comments, the slots at those indices were left as `nil`,
producing arrays with embedded nil holes that downstream
`mapstructure` decoding would silently accept. Switch to an
`append`-based compaction loop, mirroring `flattenDescendArray` in
`flatten.go`, so that comments are dropped cleanly and indices on
the output remain contiguous.
No metadata array carries comments today, so this is a latent fix
rather than a behaviour change for any current input.
Signed-off-by: Hidde Beydals <hidde@hhh.computer>sopsToGoSlice
1 parent 8621559 commit a1e776c
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
0 commit comments