technoweenie/grohl — pull request #16 by alindeman (2014-08-06 00:49:00+00:00)
Title: Prevent issues with stacks exactly 11 deep

I was seeing `panic serving 10.40.243.118:44663: runtime error: index
out of range`
`/tmp/build_c0c3d66e-c25b-42a1-9bf2-a77b92b2f44c/.vendor/src/github.com/github/go-opstocat/haystack.go:36
+0x65a` when attempting to report an exception via grohl + go-opstocat.

[haystack.go:36](https://github.com/github/go-opstocat/blob/7faea155fd76d1c43f9dd30622664674586cbbc1/haystack.go#L36)
attempts to grab the first frame in the backtrace, but apparently the
slice was empty!

I found this bit of code which, as it was previously written, returns an
empty slice if the stack is exactly 11 frames deep.

I think the intention was to always grab the top 10 stack frames; if so,
I think it can be rewritten like this. Reminder that go's slice range
indices are exclusive: `[0:10]` means grab elements 0 through 9.

/cc: @technoweenie