28.8 sql.NullString and Handling Database NULLs
Right, let’s talk about one of the most reliably annoying little handshakes between Go’s type system and the messy reality of your database: NULL. Go has a wonderful, strict, “zero-value” philosophy. A string is never nil; it’s just an empty string "". The database world, however, is a land of ambiguity and forgotten data. A VARCHAR column can absolutely be NULL, meaning “this value is intentionally unknown.” It’s not empty, it’s not zero, it’s nothing. And Go despises this kind of ambiguity.