I want to tell a story about how a seemingly innocent and often useful language feature caused us an embarrassing bug in production.
The feature is Go's behavior of allowing fields to be omitted in struct literals and having their type's zero value as a default. This feature has definitely been convenient for me before, but today it caused me such an embarrassment that I almost wish the language didn't have it.
I added a new field to a domain model in our app. However, I forgot to copy the value over in some of the places where a new instance of this struct is created from an old one, causing it to be set to 0. This resulted in us showing incorrect prices on our project costs report. Also, this was the third bug this week that this customer has encountered.