[go-nuts] Re: Is overwriting contents of pointer field the expected behavior of json.Unmarshal?

2022-08-23 Thread Mateusz Wójcik
I'm aware of why the JSON unmarshal overwrites contents of the pointer, as I followed the code. I'm also aware of how to pass the slice argument "correctly". There's a problem with section (2) because that's not exactly what happens > during append. There was a proposition to re-initialize

[go-nuts] Is overwriting contents of pointer field the expected behavior of json.Unmarshal?

2022-08-22 Thread Mateusz Wójcik
The test code below demonstrates a json.Unmarshal behavior that I find unexpected. The code unmarshals arrays of objects with pointers fields. All unmarshaled objects end up sharing the same pointer value, effectively overwriting the contents of the pointer. package unmarshall import (