My simple answer is:
Using pointers you not able to copy the data.
Example:
You create a User struct and use it without point:
u := User{}
When you do this:
newUser := u you doing a copy
If the u was a pointer
newUser := &u you not doing a copy, all newUser data will be passed by
reference to u
I am not golang expert, but I think this is one possible answer.
Regards.
Rodolfo Azevedo
Em qua, 2 de jan de 2019 às 11:33, shankar shivanna <[email protected]>
escreveu:
>
> no idea, please help
>
> On Tuesday, 1 January 2019 17:04:34 UTC+5:30, 伊藤和也 wrote:
>>
>> What are the reasonable reasons to use pointers? Are pointers neseccary?
>>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.