4 ms·
In my experience, outright forgetting is very rare because an unused err should be a warning, but the following is not nearly as rare as it should be: if err !
by fl0ki 3y ago
In my experience, outright forgetting is very rare because an unused err should be a warning, but the following is not nearly as rare as it should be:
if err != nil {
return nil
}
With how boilerplate the correct version is, you learn to skip over it entirely, meaning it can be hard to spot that anything is wrong here. Linters do exist for this now, but they have so many false positives on other error handling cases that most people don't bother with them.