Skip to content
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

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Honor TimeNotBuiltin #20

merged 2 commits into from
Oct 17, 2023

Conversation

swenson
Copy link

@swenson swenson commented Oct 16, 2023

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.

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.
@swenson
Copy link
Author

swenson commented Oct 16, 2023

(format check is mostly the result of auto-generated and docs code, and not relevant to this PR, but I can fix later)

Copy link

@tomhjp tomhjp left a 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
Copy link

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.

Copy link
Author

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 {
Copy link

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

@swenson
Copy link
Author

swenson commented Oct 17, 2023

Thanks!

@swenson swenson merged commit c1a7c12 into main Oct 17, 2023
@swenson swenson deleted the vault-19781/honor-time-not-builtin branch October 17, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants