Last Updated: May 22, 2026
context.WithDeadline cancels a context at a specific point in time. Unlike WithTimeout, which takes a duration, WithDeadline takes an absolute time.Time, which is the right choice when several operations need to share one final cutoff. This chapter covers the signature, the deadline-shortening rule, how to inspect a deadline, and when to pick WithDeadline over WithTimeout.