godbg icon indicating copy to clipboard operation
godbg copied to clipboard

Follow pointers and find the value

Open tylerwince opened this issue 5 years ago • 3 comments

Suggestion from SonOfMotherDuck on reddit

tylerwince avatar Jan 24 '19 14:01 tylerwince

Is this where importing or forking go-spew as a dependency would be relevant?

andradei avatar Jan 24 '19 20:01 andradei

I am not sure we need to that -- I think they serve different purposes. My thought initially was just to do something like this:

func getExpValue(exp interface{}) {
    if reflect.ValueOf(exp).Kind() == reflect.Ptr {
        return *exp
    }
    return exp
}

tylerwince avatar Jan 24 '19 21:01 tylerwince

That will not work for double pointers. Then you will make that function recursive, and it will not handle cycles. Then you reimplement a large part of go-spew. :)

AlekSi avatar Jan 25 '19 07:01 AlekSi