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

Add NilSliceAsEmpty encode option #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

w1ck3dg0ph3r
Copy link

This is a proposal to add an option NilSliceAsEmpty to encode nil slices and pointers to nil slices as [] instead of null.

@tomaswarynyca
Copy link

@goccy What do you think about adding this functionality?

@goccy
Copy link
Owner

goccy commented Nov 14, 2022

I'm concerned that enabling this option adds a branch to the runtime code path, which hurts performance.
I think it is necessary to discuss whether the function is really necessary.

@vx416
Copy link

vx416 commented Mar 2, 2023

This function is valuable for decoding protocol buffers because the slice in the gRPC response received by the client-side will be nil if the server initializes an empty slice.

@ivanjaros
Copy link

#437

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants