Repository navigation
fix(decode): handle json.Number pointers - #215
Open
terminalchai wants to merge 1 commit into
Open
terminalchai wants to merge 1 commit into
terminalchai wants to merge 1 commit into
Conversation
Ekko82
reviewed
Oct 28, 2026
Ekko82
left a comment
There was a problem hiding this comment.
Checked 310c79586b3044981e72703b4a8c8f3bccc223b2 with Go 1.27.1 on Windows/amd64 and Windows/386. All six added subtests pass on each architecture.
Of 17 additional public-API probes per architecture, 14 pass. Six single-pointer cases that panic at base 52aa5c6dc1d27226460807054ca2107b2d54fb2d now produce the expected values or ParseError, including int64 minimum, uint64 maximum, malformed numbers and negative-to-unsigned input. Both direct-value controls keep their results. Six typed-nil controls also preserve behavior with ZeroFields on and off. Three **json.Number cases remain rejected as unconvertible on both revisions.
I did not run the full suite, race detector, vet, build or lint.
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.
Decoding a
*json.Numberinto an integer, unsigned integer, or float currently panics withinterface conversion: interface {} is *json.Number, not json.Number. For example,n := json.Number("42"); var result int64; mapstructure.Decode(&n, &result)panics instead of decoding 42.Use the already dereferenced input value in all three numeric decoders. This preserves the existing parsers and error wrapping. A focused table covers the three successful conversions and malformed-number errors.
The full race-enabled, shuffled test suite, vet, build, and CI-pinned golangci-lint v2.6.2 pass locally. Lint ran on an LF validation copy to match CI checkout formatting.
AI assistance was used for implementation, regression testing, and independent automated specification and code reviews.