Skip to content

A simple package to intercept Interrupt signals.

License

Notifications You must be signed in to change notification settings

teamlint/go-signals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚨 Signals

reference report tests coverage

Signals is a simple package to intercept Interrupt signals.

⚙️ Installation

go get -u czechia.dev/signals

👀 Example

package main

import (
	"fmt"
	"net/http"

	"czechia.dev/signals"
)

func handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "Hello, World! 👋")
}

func main() {
	fmt.Println("starting application")
	go http.ListenAndServe(":8080", http.HandlerFunc(handler))

	signals.Interrupt(func() error {
		fmt.Println("interrupt signal received")
		return nil
	})
}

About

A simple package to intercept Interrupt signals.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages