go-nil
Go nil 安全模式。路由到特定陷阱
📖 中文导读:Go nil 安全模式。路由到特定陷阱 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: go-nil description: Go nil safety patterns. Routes to specific traps.
Nil Safety
Route by Type
- Interface nil trap → see interface/
- Map nil writes → see map/
- Slice zero-value → see slice/
- Pointer receivers → see pointer/
Quick Check
- Check pointers before deref
- Check maps before write
- Typed nil != nil interface
Common Gotcha
var p *int
if p == nil { // true
fmt.Println("nil pointer")
}