On Mon, Jan 18, 2021 at 9:12 PM 'Alexander Mills' via golang-nuts <
[email protected]> wrote:
> does anyone know why calling the method would result in a nil pointer? To
> me it seems like the object for which the method is being called is nil
>
No, it is a pointer to a struct with two fields, both of which are nil. It
says `&{<nil> <nil>}`, not `<nil>`.
> var d = new(lib.UserAttributeDao)
>
You are initializing `d` to a pointer, pointing at the zero value of
`lib.UserAttributeDao` - which is a struct with two fields, I assume. So,
for the zero value, both of those are nil.
> x, err := d.GetDecryptedUserAttributes(""); // THIS RESULTS IN NIL POINTER
>
> if err != nil {
> log.Fatal(err)
> }
>
> }
>
>
> ....
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/b1f9de70-fbe6-42ad-8cf5-7fb65d0908fcn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/b1f9de70-fbe6-42ad-8cf5-7fb65d0908fcn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfFm_956psoSVYWpFcN5Un%3DdoQURvZnWO3tTFjPYiLSpWw%40mail.gmail.com.