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

Refactor: Consistently use either pointer or value receivers #4033

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

cbandy
Copy link
Member

@cbandy cbandy commented Nov 15, 2024

Subtle bugs can arise when mixing the two. A type is more coherent when it behaves as only one of (1) a value or (2) a reference.

A new linter identifies this situation but does not yet account for unmarshal methods on value types.

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • Other

Other Information:

See https://go.dev/wiki/CodeReviewComments#receiver-type and https://go.dev/wiki/MethodSets

Subtle bugs can arise when mixing the two. A type is more coherent when
it behaves as only one of (1) a value or (2) a reference.

A new linter identifies this situation but does not yet account for
unmarshal methods on value types.

See: https://go.dev/wiki/CodeReviewComments#receiver-type
See: https://go.dev/wiki/MethodSets
@cbandy cbandy merged commit 96132b8 into CrunchyData:main Nov 15, 2024
16 checks passed
@cbandy cbandy deleted the method-receivers branch November 15, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant