Skip to content

Naming clash for new cmp standard package #354

Open
@Carrotman42

Description

@Carrotman42

I am not sure where the best place to have this discussion is, but I wanted to get @dsnet's opinion on this so this seemed like a reasonable place to start.

This is an extremely popular package and is imported into many Go tests across the world. Unfortunately, the new cmp package added within the last year has the same name as this package. I can see one possibly likely scenario where I would want to import both packages: in a unit test which wanted to use cmp.Diff along with a cmpopts.SortSlice which used cmp.Less[sometype]. There may be other situations as well.

The general solution to two packages having the same name is to rename one of them, but it isn't clear exactly which should be renamed: while it seems like a package in the stdlib is more central (leading to a preference to rename the third-party go-cmp), since go-cmp predates std/cmp by many years it will be a burden to retrain people with this new rename rule.

Does this package (or its maintainers) have an opinion about how to handle this naming clash?

PS: One out-of-the-box idea I had was to add forwarding code in go-cmp to all things in std/cmp, but I think that would cause people to import the heavier-weight go-cmp package into non-test code by accident so I am not certain that's a great idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions