Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "A function appends to a slice. Which rule keeps the result correct whether or not a new backing array is allocated?" on CodeWiki (https://codewiki.com/practice/mcq/go/checkpoint-2/checkpoint-2-append-result/).
Context (verbatim from the page):
"""
A function appends to a slice. Which rule keeps the result correct whether or not a new backing array is allocated?
Always retain the slice value returned by `append`.
Ignore the return value when the original slice has spare capacity.
Take the address of the first element before every append.
"""
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.