Terminating function execution if a context is cancelled
Function calls and goroutines cannot be terminated from the caller, the functions and goroutines have to support the cancellation, often via a context.Context value or a done channel. In either case, the functions are responsible to check / monitor the context, and if cancel is requested (when the Context’s done channel is closed), return early. … Read more