Skip to content

Stacktraces in "init" are wrong #44

@hut8

Description

@hut8

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions