kisielk / errcheck

errcheck checks that you checked errors.
MIT License
2.33k stars 138 forks source link

Ignoring concurrent calls of functions that return an error #242

Closed zeddo123 closed 2 months ago

zeddo123 commented 7 months ago

Hi,

I've been looking around, and I've found a way to ignore errcheck's error when calling a function (that returns an error) concurrently with go someFunc(). In the case where somefunc might return an error, I get Error return value not checked. Although I understand that this behaviour might be useful in some cases, sometimes it would force me to wrap the call in an anonymous function just to ignore the result.

dtcaciuc commented 3 months ago

Have you tried listing the function in the exclusion file?

In general, this is the expected errcheck behavior. Considering the main purpose of the program, given a choice between "developer knows what their doing" and "they might be not handling an important error", it leans towards the latter. Explicitly ignoring the error is the correct way to go.