Intermediate
Go (Golang)
Q72 / 100
What is the context.WithTimeout vs context.WithDeadline difference?
Correct! Well done.
Incorrect.
The correct answer is B) WithTimeout accepts a duration from now; WithDeadline accepts an absolute time.Time
B
Correct Answer
WithTimeout accepts a duration from now; WithDeadline accepts an absolute time.Time
Explanation
ctx, cancel := context.WithTimeout(parent, 5*time.Second) is equivalent to context.WithDeadline(parent, time.Now().Add(5*time.Second)).
Progress
72/100