package main import ( "log" "os" "os/signal" "syscall" ) func waitForControlC() { sigc := make(chan os.Signal, 1) signal.Notify(sigc, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT) sig := <-sigc log.Printf("signal %v received, shutting down", sig) go func() { sig2 := <-sigc log.Fatal("second kill signal %v received", sig2) }() os.Exit(0) }