Closed kkoreilly closed 4 months ago
Good catch, thank you for the bug report!
The intent is to match encoding/json
's behavior when unmarshaling. I've confirmed (https://go.dev/play/p/WQ8VPf5C-L1) it resets the slice and the resulting value is {[{c} {d}]}
.
@kkoreilly I've merged #934, which should address your issue. Let me know if it worked, feel free to re-open this issue if not!
It worked, thank you!
Describe the bug When unmarshalling a slice of structs (array of tables in TOML terminology) into a Go slice, any elements already present in the slice are not reset, leading to compounding slices. This did not happen in v1.
To Reproduce
main.go
:slice.toml
:Expected behavior As stated in the code, I expected
{[{c} {d}]}
but got{[{a} {b} {c} {d}]}
.Versions
Additional context As stated above, I have confirmed that this issue did not happen in v1.