Compose a function that prints a message after being blocked until the context it accepts as a parameter is canceled.
Context cancellation and timeouts
Block until canceled
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
fmt.Println("the context is canceled")
func waitForCancellation(ctx context.Context) error {
}
<-ctx.Done()
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.