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

cmp: package name collides with de facto stdlib 'go-cmp' #61535

Closed
bitfield opened this issue Jul 23, 2023 · 2 comments
Closed

cmp: package name collides with de facto stdlib 'go-cmp' #61535

bitfield opened this issue Jul 23, 2023 · 2 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@bitfield
Copy link

I missed the memo where constraints was renamed to cmp, but if I'd seen it, I would have pointed out that this name collides with an extremely widely-used package, go-cmp/cmp. As in, for example:

if !cmp.Equal(want, got) {
  t.Error(cmp.Diff(want, got))
}

Sure, the stdlib is privileged: it can name packages whatever it wants, and it's for third-party package authors to change their names to avoid collisions. But, in this case, go-cmp was there first, and it's so commonly used I'd say it's part of the de facto stdlib.

I'd like to see a cmp package in Go, and I'd like it to have the functionality of go-cmp (I think this has been proposed). Until then, I think it would be wise to keep this part of the namespace open.

@robpike
Copy link
Contributor

robpike commented Jul 23, 2023

The naming decision was discussed and made in the original proposal: #59488. And as discussed at length in many places, package names have no uniqueness requirement, and it's easy to provide a distinct name in the import if there is a collision.

Note too that existing code will be unaffected because no existing code uses the new package.

This is truly not a problem.

@seankhliao seankhliao added this to the Go1.21 milestone Jul 23, 2023
@seankhliao seankhliao added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jul 23, 2023
@seankhliao
Copy link
Member

as mentioned above, it was raised multiple times in the original proposal and addressed in #59488 (comment)

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2023
@golang golang locked and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants