I found this bug while working on a package that has custom error objects. While calling a third party package, I check for errors and return a wrapped custom error from my package while also returning the third party error as a string appended to the error message.
This might be easier to explain with an example.
If we look at the file errorlint/testdata/src/fmterrorf/fmterrorf.go there is a test case that requires at least one wrap on fmt.Errorf
However, if we adjust the testcase a little bit, we get the error unexpected diagnostic: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
I found this bug while working on a package that has custom error objects. While calling a third party package, I check for errors and return a wrapped custom error from my package while also returning the third party error as a string appended to the error message.
This might be easier to explain with an example.
If we look at the file
errorlint/testdata/src/fmterrorf/fmterrorf.go
there is a test case that requires at least one wrap onfmt.Errorf
However, if we adjust the testcase a little bit, we get the error
unexpected diagnostic: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
I would like to keep wrapping the package's custom errors as they are already part of the public API.