# panic: runtime error: invalid memory address or nil pointer dereference [recovered]

- **ID:** `go/goroutine-panic-nil-pointer`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

在goroutine中访问了nil指针，通常因为共享数据结构未初始化或依赖未设置。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.21 | active | — | — |

## Workarounds

1. **** (80% success)
   ```
   go func(){ if p == nil { return }; /* 使用p */ }()
   ```
2. **** (90% success)
   ```
   var once sync.Once; once.Do(func(){ p = &T{} })
   ```

## Dead Ends

- **** — 数据竞争可能导致goroutine看到nil或部分初始化值。 (70% fail)
- **** — recover只能恢复panic，但根因未解决，可能导致后续问题。 (80% fail)
