{
  "id": "go/race-detector-write-read",
  "signature": "WARNING: DATA RACE\nWrite at 0x00c0000b4010 by goroutine 7:\n  main.main.func1()\nPrevious read at 0x00c0000b4010 by main goroutine:",
  "signature_zh": "警告：数据竞争\nGoroutine 7 写入地址 0x00c0000b4010\n主 goroutine 先前读取地址 0x00c0000b4010",
  "regex": "WARNING:\\ DATA\\ RACE\\\nWrite\\ at\\ 0x00c0000b4010\\ by\\ goroutine\\ 7:\\\n\\ \\ main\\.main\\.func1\\(\\)\\\nPrevious\\ read\\ at\\ 0x00c0000b4010\\ by\\ main\\ goroutine:",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A shared variable is read and written by different goroutines without synchronization. Go's memory model gives no ordering guarantees, so torn reads and stale values occur.",
  "root_cause_type": "generic",
  "root_cause_zh": "共享变量被不同 goroutine 无同步地读写。Go 内存模型不提供顺序保证，因此会出现撕裂读取和过期值。",
  "versions": [
    {
      "version": "1.1+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Hides the symptom; the underlying race can corrupt memory or produce wrong results silently.",
      "fail_rate": 0.92,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Go has no volatile keyword; the compiler and CPU may still reorder accesses.",
      "fail_rate": 0.98,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.97,
      "how": "var mu sync.Mutex\nvar counter int\nmu.Lock()\ncounter++\nmu.Unlock()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.96,
      "how": "var counter atomic.Int64\ncounter.Add(1)\n_ = counter.Load()",
      "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-01-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}