Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow pointers and find the value #2

Open
tylerwince opened this issue Jan 24, 2019 · 3 comments
Open

Follow pointers and find the value #2

tylerwince opened this issue Jan 24, 2019 · 3 comments

Comments

@tylerwince
Copy link
Owner

tylerwince commented Jan 24, 2019

Suggestion from SonOfMotherDuck on reddit

@andradei
Copy link

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

@tylerwince
Copy link
Owner Author

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
}

@AlekSi
Copy link
Contributor

AlekSi commented Jan 25, 2019

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants