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