evalphobia / logrus_sentry

sentry hook for logrus
MIT License
194 stars 78 forks source link

Stacktraces in "init" are wrong #44

Open hut8 opened 7 years ago

hut8 commented 7 years ago

If I have func init() { ... } in several different files in the same package, and I log an error from one of them, the stacktrace seems to be put at the end of the last line in the init() that is declared in the last source file (sorted alphabetically). Although I could be wrong and this could be a coincidence in my case.

According to the Go spec, what I'm doing is legal: https://golang.org/ref/spec#Package_initialization

Multiple such functions may be defined per package, even within a single source file.