Go Nil

Go nil safety patterns. Routes to specific traps. Use when this capability is needed.

tomevault-io Updated

File contents

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")
}

Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/jamesprial--claudefiles--nil commit ba9b397d9a

Frequently asked questions

npx skillmds@latest add tomevault-io/go-nil