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

chore: keep pointer receiver consistent in generated go code #7216

Closed
wants to merge 1 commit into from

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Apr 29, 2024

Some linters don't like this, which is a small issue, but it's super easy to fix :D

Some linters don't like this, which is a small issue, but it's super
easy to fix :D

Signed-off-by: Justin Chadwell <[email protected]>
Copy link
Contributor

@aweris aweris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Contributor

@sipsma sipsma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems fine, but sort of confused that a linter would complain about this since it's completely legit+expected to sometimes need a mix of pointer and non-pointer receivers. Hopefully it's intelligent enough to identify those cases. Just mentioning since I don't think we can necessarily guarantee we will always follow this rule indefinitely.

@jedevc jedevc closed this Apr 30, 2024
@jedevc
Copy link
Member Author

jedevc commented Apr 30, 2024

Woops, test failures are entirely legitimate here.

When implementing the MarshalJSON function, this was deliberate: we directly call json.Marshal on values being returned from user-defined functions - which can be objects directly, instead of pointers to those objects.

In actuality, it should be the other way round here! We should be doing the same for concrete iface definitions as well (since those can also be returned from functions, in which case the method wouldn't have been called).

@jedevc
Copy link
Member Author

jedevc commented Apr 30, 2024

Ugh, can't re-open this PR since I force-pushed the branch after closing it? Opened #7219 instead.

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.

None yet

3 participants