Skip to content

Prevent Proliferation of signal.Notify handlersย #2951

@jerm-dro

Description

@jerm-dro

Summary

Toolhive depends on signal.Notify in numerous places. In isolation, signal.Notify is not a problem, but relying on it in many places can create confusing and non-deterministic shutdown behavior.

Outside of main.go files, we should instead rely on clearer patterns for shutdown (e.g. context cancellation or ideally, callers invoking shutdown functions in deterministic order). Even with such patterns in place, we should discourage additional use of signal.Notify via a lint rule, so that all toolhive systems have easily maintainable shutdown behavior.

Definition of Done

A lint rule prevents use of signal.Notify or signal.NotifyContext outside of main.go files.

Existing callers outside of main.go are either removed or grandfathered in as ignored.

Additional Context

#2927 (review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgoPull requests that update go codetech-debt

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions