clictx
clictx copied to clipboard
CliCtx
As of Go1.16 there is a function in the standard library for doing this, I will no longer maintain this library. This package helps you to create a context that cancels on specific signals.
Usage:
package main
import "github.com/fzerorubigd/clictx"
func main() {
ctx := clictx.Context() /* Pass a specific signal to watch only for that
signal, otherwise, all signals */
// Your application entry point, you need to use this context as base for all
// context in your application
// app(ctx)
<- ctx.Done()
}