Context 默认上下文 context.Background是上下文的默认值,所有的其他上下文都应该从它衍生出来 context.TBDO应该仅在不确定使用哪种上下文的时候使用 取消信号 context.WithCancel 源码分析 func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { // 将传入的上下文包装成私有结构体 context.cancelCtx; c := newCancelCtx(parent)