gron icon indicating copy to clipboard operation
gron copied to clipboard

Update ungron.go: fix bug: merge json.Number type

Open davidpelfree opened this issue 5 years ago • 0 comments

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
}

davidpelfree avatar Oct 26 '20 12:10 davidpelfree