New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: ignore returning value of specify package's function #8
Comments
To second that - Right now my codebase can't upgrade from golangci-lint 1.37 to 1.39 because of recent change in |
Thanks a lot for the error. That's a very good point about I also agree that making wrapcheck signature checks configurable. I will work on this and push a new build. |
In order to pre-emptively prevent other having the same issue. I've forcefully retagged v1.0.0 which was released with golangci-lint v1.39 to point to a version which fixes this for I will author a new version supporting configurable params shortly. |
I am having the same issue with |
Wondering if it would make sense to recognize function signatures like func (error,string) error and func (errror,string,...interface{}) error regardless of package they come from? Basically If a function takes error as its first parameter + a string and returns an error it's most likely wrapping it for the purpose of this linter. |
@jkowalski that sounds like quite a good suggestion to cover a general use-case. I'll look into implementing this ASAP and ship a new release. |
This has caused issues for those of us who had previously pulled |
@Aneurysm9 I've restored the tag to point to the original hash and released v1.1.0 with the more flexible default cases to ignore. I'll release another version soon with some updates to enable even more flexibility. |
Also seeing issues with Testify mocks using Neither of these cases flag issues:
When there is a type assertion the
This is true for cases other than |
馃憢 To add to the above examples, another that I've come across is when the error cannot be wrapped, e.g. in grpc-go, service handlers are meant to return a
Presently return nil, status.Errorf(codes.Unknown, "some error happened: %v", err) But because this is the |
Hey @krishicks, thanks for pointing that out. I've made the default ignore rules a little more flexible to cover this case. The next release I ship for this will include the ability to customise the signatures to ignore. But in the meantime, I hope this helps a little. I'll try get this into golangci-lint |
G'day folks, https://github.com/tomarrell/wrapcheck/releases/tag/v2.1.0 I'm going to consider this issue closed. Please report anything further in a new issue so that it can be more easily tracked. |
Hello 馃憢
Thank you for developing such a great tool!
I'm using a library that wraps and manages errors like below.
https://github.com/morikuni/failure
https://github.com/pkg/errors
Currently, wrapcheck also reports for these librarie's function.
example
This is, of course, the correct behavior. But I don't need these report from wrapcheck.
So, I ignore these reports with golangci-lint's exclude-rules like below.
https://golangci-lint.run/usage/configuration/
It would be very helpful to be able to configure these settings on the wrapcheck side.
(This proposal may be similar to #2)
Thanks
The text was updated successfully, but these errors were encountered: