Repository navigation
Feat/improve code quality - #1
Open
vinitkumar wants to merge 7 commits into
Open
vinitkumar wants to merge 7 commits into
vinitkumar wants to merge 7 commits into
Conversation
- ToXML() now always returns ([]byte, error) instead of (any, error) - ToXMLString() and ToXMLBytes() no longer need type assertions - PrettyPrint() returns []byte instead of string - Hoisted xmlDeclRegexp to package-level to avoid recompilation per call - Updated all tests to remove type assertion gymnastics Amp-Thread-ID: https://ampcode.com/threads/T-019d2b62-e1bd-75cd-b932-147353861cc0 Co-authored-by: Amp <amp@ampcode.com>
math/rand/v2 is the modern API (auto-seeded, better ergonomics). Replaces rand.Intn with rand.IntN. Amp-Thread-ID: https://ampcode.com/threads/T-019d2b62-e1bd-75cd-b932-147353861cc0 Co-authored-by: Amp <amp@ampcode.com>
Previously, extractSpecialAttrs called delete() on the input map, meaning the same data passed twice would produce different results. Now builds a shallow copy with special keys stripped instead. Amp-Thread-ID: https://ampcode.com/threads/T-019d2b62-e1bd-75cd-b932-147353861cc0 Co-authored-by: Amp <amp@ampcode.com>
Prevents infinite hangs on slow or unresponsive servers. Amp-Thread-ID: https://ampcode.com/threads/T-019d2b62-e1bd-75cd-b932-147353861cc0 Co-authored-by: Amp <amp@ampcode.com>
Replaced init() + package-level vars with a testable run() function that accepts args, stdin, stdout, stderr. CLI now has 11 tests covering help, version, string input, stdin, file, output-to-file, error cases, XPath format, and custom wrapper. Fixed .gitignore to use root-anchored patterns so the cmd/json2xml-go/ directory is not accidentally ignored. Amp-Thread-ID: https://ampcode.com/threads/T-019d2b62-e1bd-75cd-b932-147353861cc0 Co-authored-by: Amp <amp@ampcode.com>
Replaced fragile err.Error() == "EOF" with err == io.EOF in KeyIsValidXML and PrettyPrint. Amp-Thread-ID: https://ampcode.com/threads/T-019d2b62-e1bd-75cd-b932-147353861cc0 Co-authored-by: Amp <amp@ampcode.com>
These options existed in Options but were not exposed through the JSON2xml builder, forcing users to drop down to DictToXML directly. Amp-Thread-ID: https://ampcode.com/threads/T-019d2b62-e1bd-75cd-b932-147353861cc0 Co-authored-by: Amp <amp@ampcode.com>
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.
No description provided.