Sharp EdgesThe Typed Nil Interface Trap
All courses

nil != nil sometimes

Returning a typed nil pointer as error produces a non-nil interface value (type + nil data). Always return bare nil or a concrete error.

Rare tip: This bites HTTP handlers and DB layers that check if err != nil after a "no error" path.

Output
Press Run to execute your code.