AlgoMaster Logo

context.WithDeadline

Last Updated: May 22, 2026

Medium Priority
6 min read

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.

Premium Content

Subscribe to unlock full access to this content and more premium articles.