It looks, the fmt package makes some special handling for reflect.Value:

package main

import "reflect"
import "fmt"

func main() {
    var v1 = reflect.ValueOf(0)
    var p1 = &v1
    var v2 = 0
    var p2 = &v2
    var v3 interface{} = 0
    var p3 = &v3
    fmt.Println(p1)  // <int Value>
    fmt.Println(p2)  // 0xc0000b6020
    fmt.Println(p3)  // 0xc00009e220
}

On Friday, February 26, 2021 at 1:42:32 AM UTC-5 tapi...@gmail.com wrote:

> What I mean is 
>
>     fmt.Println(v3)
>
> and
>
>     fmt.Println(v3.Elem())
>
> print the same thing. Is it an intended design?
>
> On Thursday, February 25, 2021 at 11:11:52 PM UTC-5 Kurtis Rader wrote:
>
>> On Thu, Feb 25, 2021 at 8:01 PM tapi...@gmail.com <tapi...@gmail.com> 
>> wrote:
>>
>>>
>>> https://play.golang.org/p/-GZajVGPWYv
>>>
>>
>> You need to clarify your question. I don't see any obvious problem with 
>> the output of your program. The reflect.Value.Elem() call is defined to 
>> return a reflect.Elem object. But that observation might be irrelevant 
>> since you have not clearly stated the problem. 
>>
>> -- 
>> Kurtis Rader
>> Caretaker of the exceptional canines Junior and Hank
>>
>

-- 
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/4d5a2649-535e-466c-ae9e-a1797a7e9225n%40googlegroups.com.

Reply via email to