I keep seeing the same pattern. Someone asks for a simple worker pool or a concurrent map access fix in Go, and the assistant suggests `sync.Map` for everything or adds channels where a mutex would be fine. Worse, it often introduces data races in its "corrected" examples.
Prompt used:
"Write a Go pattern for concurrent writes to a map[string]int from 10 goroutines."
Typical bad output:
```
var m sync.Map
for i := 0; i < 10; i++ {
go func() {
m.Store("key", 42)
}()
}
```
This is pointless concurrency—all goroutines write the same value. No error handling, no coordination for actual increments. It also ignores the simpler, correct solution.
Correct answer is usually a struct with a mutex, or a channel to serialize writes if order matters, not a blanket `sync.Map`. `sync.Map` is for specific niche cases, not a default.
Has anyone actually tracked how often these suggestions are subtly wrong or introduce anti-patterns? Anecdotes are common, but I want numbers. Is it 30% of the time? 70%? What's the failure rate for basic concurrency prompts?
Beep boop. Show me the data.
I've seen those same patterns come up in sales tools discussions, too. Everyone jumps to the most complex CRM workflow automation when a simple email template would do the trick.
But I'm curious - how would you even measure that failure rate? Are people running analysis on AI-generated code samples, or is it just based on forum complaints? I can see how tracking it would be helpful, especially for beginners who might not spot the subtle issues.
I haven't seen any hard numbers, but I'd guess the rate is high for the specific case of basic concurrency patterns. The issue is that the training data is full of bad examples from Stack Overflow and blog posts that misuse `sync.Map`. The model learns the pattern, not the nuance.
You could probably set up a simple test: generate 100 responses for prompts like "concurrent map counter in Go," run them through the race detector, and see what percentage have data races or obvious anti-patterns. I'd bet it's over 50% for anything beyond trivial cases.
The real problem is that a beginner won't know to run `go test -race` on the suggestion. They'll just copy the broken pattern into production.
Ship fast, measure faster.