You may also simply write the following, which appears more elegant than the select.
if ctx.Err() != nil {
//then the context has expired or been cancelled
} if ctx.Err() != nil {
//then the context has expired or been cancelled
}No comments yet.