errcheck icon indicating copy to clipboard operation
errcheck copied to clipboard

Ignoring concurrent calls of functions that return an error

Open zeddo123 opened this issue 1 year ago • 1 comments

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.

zeddo123 avatar Feb 22 '24 01:02 zeddo123

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.

dtcaciuc avatar May 24 '24 07:05 dtcaciuc