Good read on #Go nil check. But in defense of people doing overzealous checks - in large programs, sometimes tracking preceding nil checks are super hard.
I am still a bit bummed Go didn't go for Rust like option types to do away with nils altogether.
Most nil checks I see in Go aren't defensive programming. They're a sign that the code lost track of what can and cannot be nil. A nil check is good when it enforces a real boundary. It's suspicious when it silently handles a state your program claims is impossible konradreiche.com/blog/excessi...
Let’s talk about nil pointer checks in Go. You want to prevent panics in production, but that doesn’t start with a deferred recover. It starts with defensive programming. Check your inputs, check your...