skills/smithery.ai/go-nil-interface

go-nil-interface

Installation
SKILL.md

Interface Nil Trap

Problem

A typed nil pointer stored in an interface is NOT nil.

Pattern

WRONG - Typed nil escapes

func GetUser(id int) error {
    var err *MyError  // typed nil
    if id < 0 {
        err = &MyError{"invalid id"}
    }
    return err  // Returns non-nil interface containing nil pointer!
}
Installs
1
First Seen
Mar 20, 2026
go-nil-interface from smithery.ai