Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "Which worker-loop design responds promptly when its request is cancelled?" on CodeWiki (https://codewiki.com/practice/mcq/go/checkpoint-3/checkpoint-3-cancellation-loop/).
Context (verbatim from the page):
"""
Which worker-loop design responds promptly when its request is cancelled?
Select between the work operation and `<-ctx.Done()`, returning `ctx.Err()` on cancellation.
Store the context in a global variable and poll it only after all work completes.
Replace the context with `time.Sleep` so the worker eventually wakes up.
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in Go. Where you are unsure, say so.