Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support duplicate numeric values #1

Merged
merged 6 commits into from
Jul 7, 2023
Merged

Support duplicate numeric values #1

merged 6 commits into from
Jul 7, 2023

Conversation

lafrenierejm
Copy link
Owner

@lafrenierejm lafrenierejm commented Jul 7, 2023

This is based on tomnomnom#76. The description from that PR:

The bug is when merging 2 numbers from 2 gron files / lines.

Try this:

echo -e "json.a=1;\njson.a=2;" | gron -u

You will fail with:

failed to merge statements: unexpected data type for merge

My fix:

  1. Gives a slightly more detailed message, telling you what type caused the failure.
  2. After I saw that this type was json.Number, I have added it to the case statement of other number types.

After my fix you will see this output:

{
  "a": 2
}

@lafrenierejm lafrenierejm merged commit 28ca79c into master Jul 7, 2023
@lafrenierejm lafrenierejm deleted the json-number branch July 7, 2023 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants