-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
New style check "mixing pointer and value receivers" #1337
Labels
Comments
This is out of scope for Staticcheck on account of false positives; I don't think the guideline is universally true. It would certainly flag some exported APIs in the Go standard library. |
dominikh
added
new-check
and removed
needs-triage
Newly filed issue that needs triage
labels
Dec 1, 2022
This wouldn't be as straightforward because some interfaces de facto require a value or a pointer receiver. Most notably, the (un)marshaling ones. See #911 and the issues mentioned there. |
Sure, I see where you are coming from. I run this tool on large enterprise
projects, and there was surprisingly rare instances of false positives.
UnmarshalJSON and alike are apparently not as prevalent. Well, thanks
anyways! Until next time then! 👋🏻
…On Thu, 1 Dec 2022 at 23:33, Ainar Garipov ***@***.***> wrote:
This wouldn't be as straightforward because some interfaces *de facto*
require a value or a pointer receiver. Most notably, the (un)marshaling
ones. See #911 <#911> and the
issues mentioned there.
—
Reply to this email directly, view it on GitHub
<#1337 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWMCRKZKLYRS4YH4ZHXVR3WLDANZANCNFSM6AAAAAASPYPJGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what?
similar to https://github.com/nikolaydubina/smrcptr
why?
Go has rules on how it can automatically select value and method receivers, which is complex and can lead to bugs.
Official Go guideline recommends:
Google Go style guide: https://google.github.io/styleguide/go/decisions#receiver-type
approach
Probably similar to https://github.com/dominikh/go-tools/blob/master/stylecheck/lint.go#L295
I can implement in free time too.
🙇🏻♂️
The text was updated successfully, but these errors were encountered: