Go Version 1.18
Context是Go语言在1.7版本之后加入的一个标准库的接口,其定义如下:
A Context carries a deadline, a cancellation signal, and other values across
API boundaries.
Context's methods may be called by multiple goroutines simultaneously.
Context跨越API边界传递超时、取消信号和其他值
Context核心方法
type Context interface {
Deadline() (deadline time.Time, ok bool)
Done()