A small tool that helps you with gracefull shutdown.
To download the package, run:
go get github.com/hanagantig/gracy
Import it in your program as:
import "github.com/hanagantig/gracy"
A simple usage:
myServer := http.NewServer()
gracy.AddCallback(func() error {
return myServer.Stop()
})
err := gracy.Wait()
if err != nil {
logger.Error("failed to gracefully shutdown server")
}