Standard library / os/signal
os/signal.Reset()
Undoes previous Notify registrations for listed signals; with no arguments it resets all such handlers. Do not assume it reverses an earlier Ignore call: the installed runtime retained the ignored disposition in an initial probe. This example registers and then resets a notification without sending a post-reset signal. Example intended for Linux/AMD64 with Go 1.23.2 in a disposable working directory; other platforms may differ. Expected stdout: 'notification reset\n'.
Formal Syntax & Structure
go syntaxgo
func Reset(sig ...os.Signal)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| sig | ...os.Signal | Signal or list of signals, as indicated by the signature. |
Working Example
Example Snippetgo
package main
import ( "fmt" "os" "os/signal" "syscall")
func must(e error) { if e != nil { panic(e) }}func main() { c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGUSR1) signal.Reset(syscall.SIGUSR1) fmt.Println("notification reset")}