Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacktraces in "init" are wrong #44

Open
hut8 opened this issue Apr 16, 2017 · 0 comments
Open

Stacktraces in "init" are wrong #44

hut8 opened this issue Apr 16, 2017 · 0 comments

Comments

@hut8
Copy link

hut8 commented Apr 16, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant