graceful,safty exit for your golang program.
/
go get github.com/lingdor/gexit
init module code :
ctx:=context.Background()
gexit.InitGExit(ctx)
exit func callback
gexit.AddPreExitFunc(func(){
fmt.Println("pre exit invoked!")
})
Context run
ctx:=gexit.GetContext() //get exit context
for{
select{
case <-ctx.Done(): //when exit event
fmt.Printf("goroutine %d at done!\n",num)
return
default:break
}
//normal program
}
https://github.com/lingdor/gexit-example
#contact
mailto: [email protected]