errcheck
errcheck copied to clipboard
Allow checking that excluded errors are always ignored
We have code like
buffer := bytes.Buffer{}
_, _ = buffer.WriteString("")
We always want to ignore these errors, so I want to add some -exclude
or -ignore
rules and use
buffer := bytes.Buffer{}
buffer.WriteString("")
However, to keep to code consistent we also need to guard against accidentally using
the deprecated _, _ = buffer.WriteString("")
in future.
Would it be reasonable to be able to say "make sure that errors from bytes.Buffer.Write*
are never used"?
I'm thinking of adding a global flag that enables this check for all excluded errors. Are there errors that need only be checked sometimes? :thinking: I can't think of any.