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 the slice element 
> before each element is "appended" by unmarshal (so it'd work like "real" 
> append does and be in sync with the doc) but it was rejected (and that's 
> very good as it broken some code). Real behaviour of unmarshal can maybe be 
> described better by saying that it allocates slice elements with zeroinit 
> and overwrites slice elements when allocation isn't needed. 
>

Yes, that's exactly what I'm aiming at. If the current behavior is 
intended, the documentation doesn't convey it correctly.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/36564c5c-0ffa-44de-b11f-527fd6a51744n%40googlegroups.com.

Reply via email to