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

ISSUE #166 Update GetDiffStat functionality #171

Conversation

DataDavD
Copy link
Contributor

This PR will close #166 by updating GetDiffStat functionality.

Specifically we update the GetDiffStat functionality so that now users
can add in a slice of strings named Fields in the DiffStatOptions.
Using this option users can exclude or only include certain parts
of the JSON response. For example if you don't want lines_added
or lines_removed from the values/DiffStat JSON response object
then you would assign
DiffStatOptions.Fields = []string{"-values.lines_removed", "-values.lines_added"}
and if you wanted just lines_added you would instead do
DiffStatOptions.Fields = []string{"values.lines_added"}.

Note, currently, given how the json decoding is although we remove the
specified fields from the JSON response, they get unmarshalled as zero
values for the corresponding DiffStatRes fields.

Also, a test was added, but we should probably improve it by testing
whether or not what we removed/selected is present accordingly.

This commit updates the GetDiffStat functionality so that now users
can add in a slice of strings named Fields in the DiffStatOptions.
Using this option users can exclude or only include certain parts
of the JSON response.

Note, currently, given how the json decoding is although we remove the
specified fields from the JSON response, they get unmarshalled as zero
values for the corresponding DiffStatRes fields.

Also, a test was added, but we should probably improve it by testing
whether or not what we removed/selected is present accordingly.
Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. THank you.

@ktrysmt ktrysmt merged commit cfcf42a into ktrysmt:master Nov 17, 2021
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.

Add DiffStat functionality to remove certain fields from response
2 participants