Perhaps 

There is a handy exception, though. When the value is addressable, the 
> language takes care of the common case of invoking a pointer method on a 
> value by inserting the address operator automatically. In our example, the 
> variable b is addressable, so we can call its Write method with just 
> b.Write. The compiler will rewrite that to (&b).Write for us.


clarifies your confusion.

You can find such paragraph 
in https://golang.org/doc/effective_go.html#pointers_vs_values 

On Wednesday, 23 January 2019 09:52:02 UTC+1, Xinhu Liu wrote:
>
> Why is that a problem? I can indeed call it on value (at line 20). I got 
> result:
>>
>> hello
>> hello
>> Program exited.
>>
>>
> I am now more confusing when I come to 
> https://golang.org/doc/faq#different_method_sets. 
>
> Am Mi., 23. Jan. 2019 um 06:47 Uhr schrieb Andrei Avram <
> andrei.a...@gmail.com <javascript:>>:
>
>> If it's about a method you've defined on a pointer and you want to call 
>> it on the value: https://play.golang.org/p/zMVivcaXrf3
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/golang-nuts/xOsuXPe1IUo/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> golang-nuts...@googlegroups.com <javascript:>.
>> 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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to