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

Provide Diff statistics #323

Open
shibumi opened this issue Feb 20, 2023 · 1 comment
Open

Provide Diff statistics #323

shibumi opened this issue Feb 20, 2023 · 1 comment
Labels
reporter Improvements in the difference reporter

Comments

@shibumi
Copy link

shibumi commented Feb 20, 2023

Hey there,

we have a Google internal Use case, where it would be nice to support Diff statistics. Any chance that we can get this into go-cmp?

I thought about something like:

  • Total: Total number of Differences (each line counts as a difference)
  • Additions: Number of additions
  • Changes: Number of Changes
  • Removals: Number of Removals

As first draft a total number is sufficient.

@dsnet
Copy link
Collaborator

dsnet commented Feb 20, 2023

This is highly specialized and I don't think there needs to be first-class support for it in cmp.

You can accomplish this yourself using a custom Reporter.

The output of Diff is implemented in terms of a Reporter. You can look at the implementation in the cmp package and take the relevant parts to gather the statistics you care about.

@dsnet dsnet added the reporter Improvements in the difference reporter label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reporter Improvements in the difference reporter
Projects
None yet
Development

No branches or pull requests

2 participants