You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to compare identical empty objects or other simple objects results in a panic if no options are provided. The name is a little misleading since options imply (to me at least) that they are not required.
For instance: diff, _ := jsondiff.Compare([]byte({}), []byte({}), nil)
Adding opts := DefaultConsoleOptions() and passing it in (as in the unit tests) prevent it from panicking. I didn't get a chance to see what it is expecting just yet.
On a different note, thank you for sharing this repo. I have a project where we are not using it for debugging, but it is useful for finding superset matches in arbitrary json bodies.
The text was updated successfully, but these errors were encountered:
Sorry for a late response. I guess calling "options" is not the best idea. As it's not optional. I will think about renaming it to "Arguments" or something like that before releasing 1.0.
Sadly I don't see a way to actually make it optional as there is no generic format. Most formats are specific to their environment. Be it JSON, linux terminal or HTML.
Perhaps I should call it "Formatt". E.g. "DefaultConsoleFormat()". But then it contains options also right now. Naming is hard.
Trying to compare identical empty objects or other simple objects results in a panic if no options are provided. The name is a little misleading since options imply (to me at least) that they are not required.
For instance:
diff, _ := jsondiff.Compare([]byte(
{}), []byte(
{}), nil)
Adding
opts := DefaultConsoleOptions()
and passing it in (as in the unit tests) prevent it from panicking. I didn't get a chance to see what it is expecting just yet.Output:
Simple examples here: https://play.golang.org/p/vSdHmaOY3zw
On a different note, thank you for sharing this repo. I have a project where we are not using it for debugging, but it is useful for finding superset matches in arbitrary json bodies.
The text was updated successfully, but these errors were encountered: