You might want to use `Printf("the dao: %+v", dao)`, for example - it will also print type-names and should make it more obvious what you have.
On Mon, Jan 18, 2021 at 9:16 PM Axel Wagner <axel.wagner...@googlemail.com> wrote: > On Mon, Jan 18, 2021 at 9:12 PM 'Alexander Mills' via golang-nuts < > golang-nuts@googlegroups.com> 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 golang-nuts+unsubscr...@googlegroups.com. >> 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 golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfE-9MOHLrO%3DQJ4L5oE-S655TB3tAxM6w24Ne_tABvWPsw%40mail.gmail.com.