-
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
jsonpb: unexpected output for small negative google.protobuf.Duration #883
Comments
Thank you for the report. @cybrcodr, can you confirm whether this was fixed in v2? |
Also, if the fix is simple, it may be doing in v1 as well. |
This is fixed in v2. Minor, I think the posted sample code is comparing with slightly wrong value, a negative nanosecond is "-0.000000001s" (8 zeroes). The bug in V1 is that it puts the negative sign after the decimal. Yeah, I can look into fixing this for v1. Logic can be carried over from -- https://go.googlesource.com/protobuf/+/refs/heads/master/encoding/protojson/well_known_types.go#651 |
Fix output for negative nanoseconds with zero second. Add validation on min/max seconds. Fixes #883.
Thank you. Do you plan to release v1.3.2 any time soon? |
full diff: golang/protobuf@v1.2.0...v1.3.2 protobuf v1.3.2: - golang/protobuf#785: grpc code generation: add an UnimplementedServer type implementing each server interface, returning an unimplemented error for each method - golang/protobuf#851: convert prints to os.Stderr to use log.Printf - golang/protobuf#883: jsonpb: fix marshaling of Duration with negative nanoseconds protobuf v1.3.1: - The set of dependencies specified in go.mod has now been reduced to only the standard library. protobuf v1.3.0: - golang/protobuf#699: add a go.mod module file - golang/protobuf#701: stop generating package "// import" comment - golang/protobuf#741: deprecate {Unm,M}arshalMessageSet{JSON} - golang/protobuf#760: different internal implementation of oneofs - `.pb.go` files generated by [email protected] will require the [email protected] package to work - various minor changes to code generation Signed-off-by: Sebastiaan van Stijn <[email protected]>
What version of protobuf and what language are you using?
Version: v1.3.1
What did you do?
https://github.com/AlekSi/go-bug/tree/master/jsonpb
What did you expect to see?
"-0.00000001s"
What did you see instead?
Unexpected result: "0.-00000001s"
The text was updated successfully, but these errors were encountered: