Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGocontext cancel deadline valuesSingle-choice MCQ

A child context is created from a parent that already has an earlier deadline. What deadline does the child report, and when is it canceled?

parent, cancelP := context.WithTimeout( context.Background(), 50*time.Millisecond) defer cancelP() child, cancelC := context.WithTimeout(parent, 1*time.Hour) defer cancelC() <-child.Done() fmt.Println(child.Err()) dl, _ := child.Deadline() fmt.Println(dl.Sub(time.Now()) < time.Minute)