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

After calling cancel() on a context obtained from context.WithCancel, what does the second print statement output?

ctx, cancel := context.WithCancel(context.Background()) cancel() fmt.Println(errors.Is(ctx.Err(), context.Canceled)) fmt.Println(ctx.Err() == context.Canceled)