-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 flag to control pb struct tag omitempty
#1371
Comments
The supported way to marshal a protobuf message as JSON is the You can use the The |
Closing: The |
Got it, thanks. |
Is your feature request related to a problem? Please describe.
In the code, the
omitempty
tag is hard-coded:protobuf/protoc-gen-go/generator/generator.go
Line 2225 in 5d5e8c0
thus it will shadow some of zero field values, like
errCode int32 = 1, if errCode = 0 then it will not be showed in the output.
Describe the solution you'd like
Hope add tag flag like below is preferred:
Describe alternatives you've considered
A hack method is:
Obviously it is not elegant, hope pb add flag officially, thanks.
The text was updated successfully, but these errors were encountered: