Excessive nil pointer checks in Go

Go coders are fighting over ‘safety checks’ that may be hiding bigger mistakes

TLDR: The article says extra “nil” checks often don’t make software safer—they can hide the real mistake instead of fixing it early. Commenters turned that into a bigger brawl over AI-written code, old-school coding philosophy, and whether Go’s design is the deeper problem.

A surprisingly spicy fight has broken out over a very simple question: should programmers keep adding extra “just in case” checks, or are those checks actually covering up bad code? The original piece argues that if a part of your program is missing something essential, you should catch that mistake immediately, not sprinkle little guard rails everywhere and hope for the best. In plain English: don’t quietly tape over a crack in the wall if the foundation is broken.

But the comments? That’s where the real show started. One camp basically said, “Nice theory, but welcome to the real world,” with bediger4000 predicting we’re heading into an era of way more of these checks because AI coding tools will keep adding them forever. Another crowd turned this into a philosophy war: is this defensive programming or contract programming—aka should code distrust everything, or should it demand good inputs from the start? usrnm called it an ancient argument, the kind that has launched a thousand code review battles.

Then came the language snobs and the reformers. One commenter wanted neat “Maybe” wrappers so missing values are explicit instead of lurking like jump-scares. Another bluntly said this whole mess exists because Go mixes up “optional” with “pointer,” while praising Rust for solving it already. In other words, what began as a warning about sloppy safety checks instantly turned into a full-on community pile-on about AI, software design, and whether Go’s whole setup is the real villain. Classic internet: one tiny check, maximum drama.

Key Points

  • The article argues that nil pointer checks in Go are useful in some cases but can also signal that code no longer clearly enforces what values may be nil.
  • It uses a RateLimiter with a Redis client to show that checking a dependency for nil at the point of use hides an earlier construction or initialization failure.
  • The article says moving the nil check into a constructor is better than checking later, but still allows an invalid state to enter the system.
  • It recommends handling initialization errors immediately where dependencies are created instead of propagating nil pointers through deeper layers.
  • The article suggests explicitly modeling temporary dependency unavailability and compares strong runtime invariants to database constraints such as NOT NULL and foreign keys.

Hottest takes

"we'll have to get used to far more nil checks than even bad programmers" — bediger4000
"This argument is very old... and I have found myself on both sides" — usrnm
"This is the mess a language lands on when it conflates optionality... with references/pointers" — diarrhea
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.