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

proposal: cmd/go: canonical module aliasing #45980

Closed
yrashk opened this issue May 5, 2021 · 5 comments
Closed

proposal: cmd/go: canonical module aliasing #45980

yrashk opened this issue May 5, 2021 · 5 comments

Comments

@yrashk
Copy link

yrashk commented May 5, 2021

As per the Proposal Process, opening this brief issue for a discussion.

There are a few cases where module naming get messy. These are the ones I observed so far:

  1. Mismatch between go-import tag and reality.

As an example, I'll use one of my projects: https://github.com/bpxe/bpxe

If you'll look into go.mod, you'll see it's defined as bpxe.org. GitHub serves HTML meta tags for it, but they are set for github.com/bpxe/bpxe.

But if I use go get github.com/bpxe/bpxe, I'll naturally get this:

	module declares its path as: bpxe.org
	        but was required as: github.com/bpxe/bpxe

Which is not fatal, of course, but is definitely annoying.

  1. Renaming a module. Let's say there's cockroachdb and if they decide to use a different name (say, cockroachdb.com/cockroachdb), if packages that use github.com/cockroachdb/cockroach will want to stay up to date, they'll have to be notified of the renaming as they won't be able to figure that out easily.

So, my rough proposal would be to augment module validation to something like this: if a module declares its path as A but was required as B, try to "go get" B and see if it resolves to the same VCS URL as A. If it does, it is in fact the same module.

Any thoughts?

@gopherbot gopherbot added this to the Proposal milestone May 5, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) May 5, 2021
@ianlancetaylor
Copy link
Contributor

CC @bcmills @jayconrod

@jayconrod
Copy link
Contributor

Related #26904

cc @matloob

@bcmills
Copy link
Contributor

bcmills commented May 5, 2021

This is more-or-less exactly what I plan to do for Go 1.18. I'll follow up with a more detailed design at some point in the next month or so.

@yrashk
Copy link
Author

yrashk commented May 5, 2021

@bcmills That sounds great! Please let me know if I can help in any way to get this to fruition. I'd love to have this in 1.18!

@rsc
Copy link
Contributor

rsc commented Jul 14, 2021

Because Bryan is working on a plan for this already,
we don't need to track this idea in this issue as well, so
I am going to close this issue as "coming soon".

@rsc rsc changed the title Proposal: canonical module aliasing proposal: cmd/go: canonical module aliasing Jul 14, 2021
@rsc rsc closed this as completed Jul 14, 2021
@rsc rsc moved this from Incoming to Declined in Proposals (old) Dec 1, 2021
@golang golang locked and limited conversation to collaborators Jul 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

6 participants