Skip to content

Add NilSliceAsEmpty encode option#398

Open
w1ck3dg0ph3r wants to merge 1 commit intogoccy:masterfrom
w1ck3dg0ph3r:feature/nil-slices-as-empty
Open

Add NilSliceAsEmpty encode option#398
w1ck3dg0ph3r wants to merge 1 commit intogoccy:masterfrom
w1ck3dg0ph3r:feature/nil-slices-as-empty

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.

5 participants