Navigation Menu

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

x/pkgsite: Update docs to explicitly allow mixed reciever types. #56941

Closed
DevX86 opened this issue Nov 25, 2022 · 1 comment
Closed

x/pkgsite: Update docs to explicitly allow mixed reciever types. #56941

DevX86 opened this issue Nov 25, 2022 · 1 comment

Comments

@DevX86
Copy link

DevX86 commented Nov 25, 2022

Please see #56939

I am looking to amend the FAQ method on values or pointers as it is currently leading to confusion and resulting in warnings being added to IDEs for valid use cases.

Specifically this section:

Next is consistency. If some of the methods of the type must have pointer receivers, the rest should too, so the method set is consistent regardless of how the type is used. See the section on method sets for details.

When there are multiple valid use cases for mixed receiver types. Many developers and IDEs such as JetBrains' GoLand, view FAQs as standards, and thus issued warnings within their linter for mixed-type receivers based upon this. Not only are there confirmed valid use cases for mixed-type receivers but in some cases like the one outlined in #56939, it should even be considered a best practice for developers especially new ones to provide safety against nil pointer receivers which there is also no explicit documentation nor recommendation on.

Is it possible to clarify this within the docs / FAQs, elaborate on these valid use cases, and remove the recommendation and perceived standard of having unilateral pointer or value receivers on types?

IMG_0568

@DevX86 DevX86 added the pkgsite label Nov 25, 2022
@gopherbot gopherbot added this to the Unreleased milestone Nov 25, 2022
@seankhliao
Copy link
Member

The previous paragraphs already explain why you might want to choose one over the other. It is, as it says, purely a recommendation for consistency.

If you have an issue with your IDE, please file an issue with them.

Duplicate of #56939

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2022
@golang golang locked and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants