fix(decoder): Correctly unmarshal !!int tagged values#770
fix(decoder): Correctly unmarshal !!int tagged values#770rybakit wants to merge 1 commit intogoccy:masterfrom
Conversation
|
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #770 +/- ##
==========================================
- Coverage 77.97% 77.83% -0.14%
==========================================
Files 22 22
Lines 8108 8134 +26
==========================================
+ Hits 6322 6331 +9
- Misses 1370 1387 +17
Partials 416 416 🚀 New features to boost your workflow:
|
3f204b6 to
3b2de25
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes the unmarshaling logic for YAML values with explicit !!int tags by introducing a new castToInt helper function that properly handles type conversions from various integer types and strings to int64/uint64.
- Replaces the previous
strconv.Atoi(fmt.Sprint(v))approach with a more robust type-switching conversion - Adds comprehensive test coverage for integer tag handling including quoted strings and various numeric formats
- Updates float tag tests to use
map[string]float64instead ofmap[string]interface{}for consistency
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| decode.go | Adds castToInt function to properly handle type conversions for !!int tagged values, replacing the previous string-based conversion approach |
| decode_test.go | Adds test cases for various !!int tagged formats (quoted strings, hex, octal) and updates existing !!float tests for type consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR fixes the unmarshaling logic to properly handle YAML values with explicit
!!inttags. For example:Error returned: