aymkhalil opened a new pull request, #865: URL: https://github.com/apache/pulsar-client-go/pull/865
Signed-off-by: Ayman Khalil <[email protected]> ### Motivation When producing messages via the go client, if the user doesn't assign an explicit `EventTime` to the message, the following `uint64` will end up on the wire: `11651379494838` This is because [TimestampMillis](https://github.com/aymkhalil/pulsar-client-go/blob/7fbfbaac9532efd3dbab7f768daca045a86d9966/pulsar/internal/utils.go#L30) calls UnixNano, but UnixNano on the zero Time is undefined. [This](https://go.dev/play/p/mDPKyxFCKLL) code mimic what happens when TimestampMillis is called on the Zero value Please note that go consumers (like this[ ](https://github.com/apache/pulsar-client-go/blob/a013ff0b7353fab87a7eb7599377bb06b46eb7b7/pulsar/consumer_test.go#L624)test) will NOT notice this issue, because this is handled correctly when [unmarshalling](https://github.com/apache/pulsar-client-go/blob/649d992f26349835d7dc1e7632d60e399bd4eaa5/pulsar/internal/pulsar_proto/PulsarApi.pb.go#L1634) on the consumer side ### Modifications *Describe the modifications you've done.* ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is already covered by existing tests, such as https://github.com/apache/pulsar-client-go/blob/a013ff0b7353fab87a7eb7599377bb06b46eb7b7/pulsar/consumer_test.go#L593. Also added simple unit test to verify `time.Time{}` marshals to `0` ### Does this pull request potentially affect one of the following parts: *If `yes` was chosen, please highlight the changes* - Dependencies (does it add or upgrade a dependency): ( no) - The public API: ( no) - The schema: ( no ) - The default values of configurations: (no) - The wire protocol: (yes) : The wire will have 0 instead of 11651379494838 for unset EventTime values. This behavior is noticed only by non-go consumers. ### Documentation - Does this pull request introduce a new feature? ( no) - If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented) - If a feature is not applicable for documentation, explain why? - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
