#With-Cancel

1 articles

Getting to Know Package Context With Cancel On Golang

Getting to Know Package Context With Cancel On Golang

Package introduction context.WithCancel

Context which can add values, we can also add cancel signals to the context. Usually context cancel is used when we need to run another process, and we want to cancel the process. This context cancel is usually run using a different goroutine so that we easily want to cancel the execution of the goroutine, so we just send a cancel signal to the context then the goroutine we want to stop can be done.