accessing fields of nil should panic, but an EXC_BAD_ACCESS in gomobile+iOS -- bug?

23 views
Skip to first unread message

ch...@figlyinc.com

unread,
Jan 18, 2018, 1:28:11 PM1/18/18
to golang-nuts
Hi,

I ran into this recently, and I'm not sure it's expected behavior.

The Go spec says that accessing a struct field on a nil pointer should panic (example: https://play.golang.org/p/KsIyVll7NE0). This panic can be recovered from.

In an iOS library built with gomobile, instead of a panic, I get a crash with an EXC_BAD_ACCESS signal. Besides not following the spec this is somewhat trickier to debug.

Is this a bug, or just an expected difference on the mobile platforms?

Cheers,
Chris
Reply all
Reply to author
Forward
0 new messages