Open maroux opened 2 months ago
I've opened 2 PRs with 2 possible fixes for this bug.
Output:
[]toml.Key{toml.Key{"table", "subtable", "subsubtable"}, toml.Key{"table", "subtable", "subsubtable", "b"}, toml.Key{"table", "subtable", "subsubtable", "b"}}
Notice how the second and third value in that slice both point to
b
.
I also encountered this bug. Please fix it.
Sample code:
Playground: https://go.dev/play/p/Rr5bm5DbEql
Output:
Notice how the second and third value in that slice both point to
b
.Expected output:
The root cause seems to be somewhere near this append call. The result of
append
can return a slice backed by the same array if the capacity is available. See Go example code: https://go.dev/play/p/2FGKuCvCUKz.