Final Thoughts
You can never write enough tests! If you look at the SQLite documentation,[41] you’ll see they have 640 lines of testing code for every source line. And even so, SQLite has bugs!
Testing is a balance between “pain versus gain.” The pain is writing tests. It takes development effort to write tests, and once you have a big enough test suite, making big changes takes longer. The gain is the damage you’ll prevent. If you write an internal system for picking where to go to lunch at work, bugs don’t hurt that much. If you write code that navigates airplanes, bugs can cost lives.
Do your own pain-versus-gain balance and make an informed decision on how much to invest in testing.
No matter how rigorous the development and testing, you ...
Get Effective Go Recipes now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.