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

MakeTypedEncoder: accept results by pointer or value #134

Merged
merged 2 commits into from Nov 2, 2018

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Nov 2, 2018

Internally, we always deserialize using pointers. However, we sometimes want to deal with values by value instead. This makes MakeTypedEncoder handle both cases.

Internally, we always deserialize using pointers. However, we sometimes want to
deal with values *by value* instead. This makes `MakeTypedEncoder` handle both
cases.
@Stebalien Stebalien requested a review from keks as a code owner November 2, 2018 00:27
@ghost ghost assigned Stebalien Nov 2, 2018
@ghost ghost added the status/in-progress In progress label Nov 2, 2018
buf := new(bytes.Buffer)
encoder := encoderFunc(buf)

if err := encoder.Encode(&fooTestObj{true}); err != nil {
Copy link

Choose a reason for hiding this comment

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

Shouldn't there be a test that passes fooTestObject by value?

Copy link
Member Author

Choose a reason for hiding this comment

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

So, internally we always pass to Encode by pointer (or should, at least).

@Stebalien Stebalien merged commit 64f3948 into master Nov 2, 2018
@ghost ghost removed the status/in-progress In progress label Nov 2, 2018
@Stebalien Stebalien deleted the fix/ptr-or-value branch November 2, 2018 14:01
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

2 participants