Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "A service struct contains a `sync.Mutex` that has already been used. Which change is safe?" on CodeWiki (https://codewiki.com/practice/mcq/go/checkpoint-3/checkpoint-3-mutex-copy/).
Context (verbatim from the page):
"""
A service struct contains a `sync.Mutex` that has already been used. Which change is safe?
Keep the struct behind a pointer and use pointer receivers instead of copying it.
Pass the struct by value so each caller receives an independent lock.
Copy the mutex only while it happens to be unlocked.
"""
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.