{
  "id": "go/race-detector-data-race",
  "signature": "WARNING: DATA RACE\nWrite at 0x00c0000b4010 by goroutine 5:",
  "signature_zh": "WARNING: DATA RACE\nGoroutine 5 在 0x00c0000b4010 处写入：",
  "regex": "WARNING:\\ DATA\\ RACE\\\nWrite\\ at\\ 0x00c0000b4010\\ by\\ goroutine\\ 5:",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Two goroutines access the same memory location without synchronization, and at least one is a write. Detected only when the binary is built with -race.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个 goroutine 在无同步的情况下访问同一内存位置，且至少一个是写操作。仅在以 -race 构建时被检测到。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Hides the symptom; the race still corrupts data nondeterministically.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Yielding does not create a happens-before relationship; race remains.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "var counter atomic.Int64\ncounter.Add(1)\nn := counter.Load()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "ch := make(chan int)\ngo func() { ch <- compute() }()\nresult := <-ch",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-28",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}