jsonpatcher: empty interface timestamp#439
Merged
sanderpick merged 2 commits intomasterfrom Sep 18, 2020
Merged
Conversation
Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
jsign
approved these changes
Sep 18, 2020
| switch ts := je.Timestamp.(type) { | ||
| case time.Time: | ||
| t = ts | ||
| case int: |
Contributor
There was a problem hiding this comment.
Should s/int/int64 considering symmetry with Time() switch case?
Contributor
Author
There was a problem hiding this comment.
I did that initially, but the type actually comes back as int when it's set on an empty interface value.
Merged
Contributor
|
@sanderpick I've just tested this fix and and now I got the gob encode error for old-format time in the So looks like empty time.Time decoded into map[string]interface which is not auto-registred in the gob I've made the issue to track it: #443 443 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #416 (comment)
After trying a few different ways to fix this, I landed on just using
interface{}forTimestamp, which allows us to continue bulk-decoding events with potentially mixedTimestamptypes.