I have a struct with a lot of fields and I have to check if any of those fields is null without having to type every field name by hand. The field's type is always a pointer so I can check without having to worry about zero-values.
I'm trying to to this using the reflection package, but it doesn't seem to be working properly and I can't figure out why.
Here is a playground replicating my problem:
http://play.golang.org/p/LOb6a8eklE
As you can see, if I check by hand everything works fine. When asked to print it prints null as well, but when comparing it evaluates to false.
Any thoughts on what is going on?
My main guess is because the return type of Interface() is, obviously, interface{}, and by storing "null" inside it, it doesn't make it "null" anymore. Any way around that?
Thanks!