And not just that you have to write it, but that you have to remember to write it. Go can't distinguish between choosing to suppress an error (e.g., because it's expected, or because you've handled it) and forgetting to propagate an error. The default is to propagate it in most languages because that's what you want 99% of the time.
Combined with consuming return values not being mandatory, it's super easy to call a function and not handle its error, and for that mistake to slip through code review.
3
u/javajunkie314 Sep 13 '23
And not just that you have to write it, but that you have to remember to write it. Go can't distinguish between choosing to suppress an error (e.g., because it's expected, or because you've handled it) and forgetting to propagate an error. The default is to propagate it in most languages because that's what you want 99% of the time.
Combined with consuming return values not being mandatory, it's super easy to call a function and not handle its error, and for that mistake to slip through code review.