Logging Panics in Go Lang on AndroidTo say that we are pretty pumped about today’s release of golang 1.4 that includes official android support is an understatement.

We believe android is really going to propel go’s popularity. I mean –
it’s not that it doesn’t already have killer apps – docker anyone? However, now the
ecosystem has just opened up an entirely new world of software engineer
that is more than willing to use it.Huge shoutout to David Crawshaw and the rest of the go team for making
this happen!We were really interested in seeing how easy it would be to integrate
deferpanic support in so we could defer our panics, log our errors and
watch memory and goroutines over time.Turns out – it’s incredibly easy.Ready to get started building android apps with golang?The repo you will be interested in is:
https://github.com/golang/mobileThe instructions are already pretty clear but I’ll go ahead and
crosspost here:Definitely use the dockerfile provided:Now create a regular go project just like normal && cp over the
Then once you launch it you can see from logcat that we are executing.
and you can see the error that was captured and posted to your
deferpanic dashboard.
BAM!As you can see – we’ve only added the two deferpanic imports and our
token. After that any errors that are instatiated will be shot up to
your deferpanic dashboard.You can get the full code here:
https://github.com/eyberg/androidtestbut as we mentioned – we only added a few lines. The example on the
gomobile repo is missing internet access permissions so you’ll need to
add those or yank the AndroidManifest.xml from our example repo.