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

Add diffing abilities to reporting #9

Merged
merged 1 commit into from
Jul 20, 2017
Merged

Add diffing abilities to reporting #9

merged 1 commit into from
Jul 20, 2017

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Jul 14, 2017

This adds an internal package with the following API:
func Difference(nx, ny int, f EqualFunc) (eq bool, es EditScript)
type EditScript []EditType
type EditType int8
const Identity EditType = iota ...
type EqualFunc func(ix int, iy int) Result
type Result struct{ ... }

The cmp.SliceIndex type has a new method SplitKeys to indicate that
elements are being compared in x and y are in different indexes.

The debug visualizer can be run:
go test -tags=debug -v github.com/google/go-cmp/cmp/internal/diff

Reviewed-By: dneil@google.com

@@ -147,6 +147,7 @@ func ExampleOption_equalEmpty() {
// false
}


Copy link
Member

Choose a reason for hiding this comment

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

Is this change intentional?

It looks like it makes the file no longer gofmted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Fixed.

Copy link
Member

Choose a reason for hiding this comment

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

Would you like a PR that adds a gofmt check to Travis CI, so this type of issue can be caught automatically by CI in all future contributions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would be great, thank you.

dsnet pushed a commit that referenced this pull request Jul 17, 2017
The default test script is `go test -v ./...` according to Travis docs at
https://docs.travis-ci.com/user/languages/go/#Default-Test-Script.

Add an additional gofmt check to help catch formatting issues in PRs.
This is motivated by a previous occurrence at #9 (comment).

Also swap the order of Go versions 1.x and 1.6. 1.x is higher priority, so it
makes more sense to run it first and report issues right away. 1.6 is lower
priority, so it's better to prioritize it lower.

Use 2 space indent in the .yml file, which is consistent with the formatting
in Travis documentation and examples.
@dsnet dsnet force-pushed the diff branch 2 times, most recently from 96e2544 to be2c714 Compare July 20, 2017 22:10
This adds an internal package with the following API:
    func Difference(nx, ny int, f EqualFunc) (eq bool, es EditScript)
    type EditScript []EditType
    type EditType int8
        const Identity EditType = iota ...
    type EqualFunc func(ix int, iy int) Result
    type Result struct{ ... }

The cmp.SliceIndex type has a new method SplitKeys to indicate that
elements are being compared in x and y are in different indexes.

The debug visualizer can be run:
	go test -tags=debug -v github.com/google/go-cmp/cmp/internal/diff

Reviewed-By: kevlar@google.com
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.

None yet

2 participants