Skip to content

drop google/go-cmp dependency #314

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

Closed
wants to merge 1 commit into from

Conversation

alexandear
Copy link
Contributor

@alexandear alexandear commented Oct 25, 2024

The PR replaces the usage of github.com/google/go-cmp/cmp package with reflect.

@mvdan
Copy link
Owner

mvdan commented Nov 13, 2024

Sorry but this is incorrect. We want to compare the types described by the syntax tree, so e.g. Field1 []int vs Field2 []string. We need to do a deep comparison of the syntax trees; a basic comparison via reflect.TypeOf will incorrectly think the two types there are equal, as they are both *go/ast.ArrayType.

I can see how the comment in the code is slightly misleading, and we don't have tests which catch the edge case I described above, so I will send a patch for the sake of those. But the proposed change to the code isn't valid as far as I can see.

@mvdan mvdan closed this Nov 13, 2024
@ccoVeille
Copy link

Does it mean some unit tests are missing then?

@mvdan
Copy link
Owner

mvdan commented Nov 13, 2024

Yes, some "fields should not be merged due to slightly different types" tests are missing as I described above. I will send a patch for those.

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.

3 participants