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

Add support for parsing json.Number to uint64 #261

Merged
merged 2 commits into from
Dec 1, 2021
Merged

Add support for parsing json.Number to uint64 #261

merged 2 commits into from
Dec 1, 2021

Conversation

onlyice
Copy link

@onlyice onlyice commented Nov 30, 2021

json.Number can represent a number in range [2^63 + 1, 2^64), which is suitable for an uint64 value but overflow for an int64 value. When parsing json.Number to uint64, current implementation can't handle number in this range.

Since json.Number is basically string, we can parse string to uint64 directly. I've also add some unit tests.

@mitchellh
Copy link
Owner

There are a couple test failures that look trivial to fix. If you can fix those up I'd be happy to merge, your impl looks good to me.

@onlyice
Copy link
Author

onlyice commented Dec 1, 2021

Sure, I've submitted the fix. Please take a look.

@mitchellh mitchellh merged commit f41e93f into mitchellh:master Dec 1, 2021
@mitchellh
Copy link
Owner

Thank you! I'll cut a new tag soon, maybe tmrw morning.

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.

None yet

2 participants