-
Notifications
You must be signed in to change notification settings - Fork 18
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
Honor TimeNotBuiltin #20
Conversation
I was running some tests elsewhere, and noticed that the `BasicHandle.TimeNotBuiltin` option was not being honored by `MsgpackHandle`. This option is critical for maintaining backwards compatibility in certain cases, notably some of our Raft usage. I added a test here to ensure that the option works. While we're here, I updated `go.mod` and `go.sum`, since I'll probably cut the 2.1.1 release after this.
(format check is mostly the result of auto-generated and docs code, and not relevant to this PR, but I can fix later) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
go.mod
Outdated
@@ -1,15 +1,15 @@ | |||
module github.com/hashicorp/go-msgpack/v2 | |||
|
|||
go 1.19 | |||
go 1.20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: are there any specific benefits we needed from bumping the minimum Go version? I would tend slightly towards leaving it for libraries unless we need to bump it - just to make it as easy as possible for dependents to upgrade, but I'm also not hugely opposed to bumping it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I can un-bump that. It doesn't really do much until 1.21.
@@ -286,6 +286,15 @@ func (e *msgpackEncDriver) EncodeFloat64(f float64) { | |||
} | |||
|
|||
func (e *msgpackEncDriver) EncodeTime(t time.Time) { | |||
// use the MarshalBinary format if requested | |||
if e.h.TimeNotBuiltin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC correctly we don't need to concern ourselves with this setting in the decode function because it handles both cases seamlessly right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.
Thanks! |
I was running some tests elsewhere, and noticed that the
BasicHandle.TimeNotBuiltin
option was not being honored byMsgpackHandle
. This option is critical for maintaining backwards compatibility in certain cases, notably some of our Raft usage.I added a test here to ensure that the option works.
While we're here, I updated
go.mod
andgo.sum
, since I'll probably cut the 2.1.1 release after this.