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

Move object diff and field path from apimachinery #82

Merged

Conversation

sttts
Copy link
Contributor

@sttts sttts commented Feb 7, 2019

Both packages are not apimachinery specific, but totally generic (and e.g. useful in k/kube-openapi).

@sttts
Copy link
Contributor Author

sttts commented Feb 7, 2019

/assign @dims @thockin

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 7, 2019
@sttts sttts force-pushed the sttts-move-diff-and-field-path branch from 38e5c32 to 8babdb0 Compare February 7, 2019 11:42
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 7, 2019
}

// ObjectReflectDiff returns a diff computed through reflection, without serializing to JSON.
func ObjectReflectDiff(a, b interface{}) string {
Copy link
Member

Choose a reason for hiding this comment

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

@smarterclayton will be happy to have this more available

Choose a reason for hiding this comment

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

So am I! This fixes my request in #75.

@liggitt
Copy link
Member

liggitt commented Feb 7, 2019

both make sense to me for use outside k/k

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

There are other diff libs out there that produce better output that ours. Should we consider them instead?

go-spew is good, but I think litter produces better output - should we look at that,

"detect nil map": {
a: map[string]int(nil),
b: map[string]int{},
out: `
Copy link
Member

Choose a reason for hiding this comment

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

this is a great place to use dedent and not have wacky indenting in string literals.

Copy link
Member

Choose a reason for hiding this comment

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

@sttts do you want to switch to dedent in this PR or a follow up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would prefer a follow-up. This is a straight move.

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

The fact that the diff APIs expose their implementation details in their names means we can probably never change these once we publish them. Are we cool with that?

@thockin
Copy link
Member

thockin commented Feb 12, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 12, 2019
@k8s-ci-robot k8s-ci-robot merged commit cdba024 into kubernetes:master Feb 12, 2019
@sttts
Copy link
Contributor Author

sttts commented Feb 13, 2019

The fact that the diff APIs expose their implementation details in their names means we can probably never change these once we publish them. Are we cool with that?

I have my doubts those details should be hidden. It makes a big difference how you extract a diff from objects. JSON is different from reflect.

@thockin
Copy link
Member

thockin commented Feb 13, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants