On Tuesday, May 2, 2017 at 10:53:36 PM UTC+2, Brian Stengaard wrote:
>
>
> On Tuesday, 2 May 2017 16:02:47 UTC-4, Pierre Curto wrote:
>>
>> Hello,
>>
>> My guess:
>> If you dont pass in a pointer, then you pass a value.
>> What would be the point of updating the value that you will never see and 
>> that will get discarded?
>> Hence it returns a map that provides the unmarshaled values so at least 
>> you have something to work with.
>>
>>>
>>>
> True, if I pass in a raw value wrapped in a blank interface. In this case 
> we are talking about a field on a struct that is already addressable - 
> which in turn makes the content of the struct field addressable - then why 
> not just update the underlying value?
>

You can't update a raw value in an interface, you can only replace it. (the 
interface value is addressable, but the value it contains isn't)
It works with pointers because only the data pointed to changes, not the 
pointer itself.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to