123123213weqw opened a new pull request, #6490: URL: https://github.com/apache/rocketmq-dashboard/pull/6490
Fixes #6437. `output.YAML.restoreNumbers` decoded every `json.Number` through `Int64()`/`Float64()` first, so literals outside machine precision were bent before rendering: `18446744073709551615` lost its exact value to float64, `0.1234567890123456789` was rounded to seventeen significant digits, and a literal too large even for float64 degraded to a quoted string — while the JSON path (which marshals `json.Number` as a bare literal) kept all three intact. `restoreNumbers` now wraps the original literal in a `yaml.Node` with the numeric tag the literal implies (`!!int` for digit-only scalars, `!!float` otherwise): the emitted YAML carries the exact digits as a bare numeric scalar — or, for the one value yaml.v3 cannot resolve back into a Go int (below `int64` min), as an explicitly `!!int`-tagged scalar that is still numeric and still exact. `TestYAMLPreservesNumericLiteralsBeyondMachineTypesTest` covers nested structures, integers past signed int64, precise fractions and exponent notation, asserting the exact digits render unquoted; the existing round-trip decode tests are unchanged and green. cc @lizhimins -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
