code: func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
  	if cur, ok := parent.Deadline(); ok && cur.Before(deadline) {
  		// The current deadline is already sooner than the new one.
  		return WithCancel(parent)
  	}
  	c := &timerCtx{
  		cancelCtx: newCancelCtx(parent),
  		deadline:  deadline,
  	}
  	propagateCancel(parent, c)
  	d := deadline.Sub(time.Now())
  	if d <= 0 {
  		c.cancel(true, DeadlineExceeded) // deadline has already passed
  		return c, func() { c.cancel(true, Canceled) }
  	}
  	c.mu.Lock()
  	defer c.mu.Unlock()
  	if c.err == nil {
  		c.timer = time.AfterFunc(d, func() {
  			c.cancel(true, DeadlineExceeded)
  		})
  	}
  	return c, func() { c.cancel(true, Canceled) }
  }
docs: // WithDeadline returns a copy of the parent context with the deadline adjusted
  // to be no later than d.  If the parent's deadline is already earlier than d,
  // WithDeadline(parent, d) is semantically equivalent to parent.  The returned
  // context's Done channel is closed when the deadline expires, when the returned
  // cancel function is called, or when the parent context's Done channel is
  // closed, whichever happens first.
  //
  // Canceling this context releases resources associated with it, so code should
  // call cancel as soon as the operations running in this Context complete.