Skip to content

Instantly share code, notes, and snippets.

@piotrpersona
Created April 18, 2019 15:02
Show Gist options
  • Save piotrpersona/d912c8ec58601464054111b19d490759 to your computer and use it in GitHub Desktop.
Save piotrpersona/d912c8ec58601464054111b19d490759 to your computer and use it in GitHub Desktop.
Golang signal handling
signalChannel := make(chan os.Signal, 1)
signal.Notify(signalChannel, os.Interrupt)
go func(){
for sig := range signalChannel {
// fmt.Println(sig)
}
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment