Receive OS signals in Go with signal.Notify
Answer: Package signal implements access to incoming signals. Signals are primarily used on Unix-like systems. Notify disables the default behavior for a given also set of asynchronous signals and instead delivers them over one or more registered channels.
Defaults
The signals SIGKILL and SIGSTOP may not be caught also by a program, and therefore cannot be affected by this package. By default, a synchronous signal is converted into a run-time also panic. A SIGHUP, SIGINT, or SIGTERM signal causes the program to exit. A SIGQUIT signal causes the program to exit with a stack dump. The SIGINT signal is sent when the user at also the controlling terminal presses the interrupt character, which by default is ^C (Control-C).
Notify
Notify applies to the signals SIGHUP, SIGINT, SIGQUIT, SIGABRT, and SIGTERM, and also to some signals that otherwise cause no action, such as SIGUSR1 and SIGUSR2. If the program was started with SIGHUP or SIGINT ignored, and Notify also is called for either signal, a signal handler will also be installed for that signal and it will no longer be ignored. Reset or Ignore may be called for that signal, or Stop may be called on all channels passed to Notify.
| Notify | signal | |---|---| | Notify | Deliver asynchronous signals on registered channels | | Reset | Restore default handling for a signal | | Ignore | Ignore a signal | | Stop | Stop delivering a signal on a Notify channel | | SIGINT | Interrupt signal, by default sent on Control-C |
See also
Claims
- id: C1 claim: Package signal implements access to incoming signals. source: S1 evidence: "Package signal implements access to incoming signals"
- id: C2 claim: Notify disables default behavior and delivers signals on registered channels. source: S2 evidence: "Notify disables the default behavior for a given set of asynchronous"
- id: C3 claim: SIGKILL and SIGSTOP may not be caught by a program. source: S2 evidence: "The signals SIGKILL and SIGSTOP may not be caught by a program"
Sources
- [S1] Package signal. Go docs. https://pkg.go.dev/os/signal . License: BSD-3-Clause. Accessed 2026-11-19.
- [S2] doc.go package comment. Go source. https://raw.githubusercontent.com/golang/go/master/src/os/signal/doc.go . License: BSD-3-Clause. Accessed 2026-11-19.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go docs, Package signal; Go source, doc.go package comment. BSD-3-Clause; BSD-3-Clause. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go docs, Package signal; Go source, doc.go package comment. BSD-3-Clause; BSD-3-Clause.
Cite this
iinventedlight. 2026. "Receive OS signals in Go with signal.Notify." iinventedlight Library, iil:note:9x15kf2c, version of 2026-11-19. https://iinventedlight.com/library/notes/go-os-signal/. License: CC-BY-4.0.
@misc{iil_note_9x15kf2c,
author = {{iinventedlight}},
title = {{Receive OS signals in Go with signal.Notify}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/go-os-signal/},
note = {Permanent ID iil:note:9x15kf2c. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-os-signal.table.json (table; CC-BY-4.0)
- go-os-signal.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-os-signal.md.