Signals are a useful way for the user or the OS to kill your running application. Sometimes, it makes sense to handle these signals in a more graceful way than the default behavior. Go provides a mechanism to catch and handle signals. In this recipe, we'll explore the handling of signals through the use of a signal handling the Go routine.
Catching and handling signals
Getting ready
Refer to the Getting ready section's steps in the Using command-line flags recipe.
How to do it...
These steps cover writing and running your application:
- From your terminal/console...