Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickfix: suggest the %w verb in fmt.Errorf #762

Open
yasushi-saito opened this issue May 26, 2020 · 2 comments
Open

quickfix: suggest the %w verb in fmt.Errorf #762

yasushi-saito opened this issue May 26, 2020 · 2 comments

Comments

@yasushi-saito
Copy link

yasushi-saito commented May 26, 2020

fmt.Errorf("message: %w", err) is better.
The latter supports the error unwrapping API added in 1.13.

@yasushi-saito yasushi-saito added the needs-triage Newly filed issue that needs triage label May 26, 2020
@ainar-g
Copy link
Contributor

ainar-g commented May 26, 2020

I'm not against it, but it will be very prone to false positives, since some people might actually want the error to be unwrappable. That's why early Go 1.13 errors proposals had the Opaque function.

@dominikh dominikh changed the title check calls of form fmt.Errorf("message: %v", err) quickfix: suggest the %w verb in fmt.Errorf Jun 1, 2020
@dominikh dominikh added new-check and removed needs-triage Newly filed issue that needs triage labels Jun 1, 2020
@dominikh
Copy link
Owner

dominikh commented Jun 1, 2020

I have relabeled this issue as a new check for quickfix, a planned set of checks that make optional suggestions strictly in the context of LSP (via gopls).

I agree with Ainar that this would cause false positives, thereby making it nonviable as an ordinary check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants