Skip to content

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

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

5 participants