Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Add support for parsing json.Number to uint64#261

Merged
mitchellh merged 2 commits into
mitchellh:masterfrom
onlyice:feature/json-number-to-uint64
Dec 1, 2021
Merged

Add support for parsing json.Number to uint64#261
mitchellh merged 2 commits into
mitchellh:masterfrom
onlyice:feature/json-number-to-uint64

Conversation

@onlyice
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Owner

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants