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: bobby96333@gmail.com