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

x/pkgsite: suggest canonical module/package path when visiting repository path #43518

danp opened this issue Jan 5, 2021 · 4 comments


Copy link

@danp danp commented Jan 5, 2021

I was recently browsing and wanted to see its godoc so I naively visited This presented me with the Oops! We couldn't find “”. page which confused me.

Then I realized it may have a different canonical module path, so I checked go.mod and indeed it's at Visiting then worked as expected.

It would be nice if pkgsite suggested visiting to me when visiting It seems to already know that comes from as part of linking under "Repository" at

This would also align with what happens when trying to go get in an existing module, which does suggest the canonical path:

% go get 
go: downloading v0.0.0-20210102024717-be19e66fb52d
go: upgrade => v0.0.0-20210102024717-be19e66fb52d
go get: parsing go.mod:
	module declares its path as:
	        but was required as:
@gopherbot gopherbot added the pkgsite label Jan 5, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jan 5, 2021
Copy link

@mvdan mvdan commented Jan 5, 2021

As someone who uses vanity import paths, this would be welcome. Too many users still default to assuming they can use the github URL as-is, as either an import path or for the docs. That should fail and it already does, but the pkgsite failure is confusing with the 404.

@jba jba modified the milestones: Unreleased, pkgsite/unplanned Jan 5, 2021
Copy link

@julieqiu julieqiu commented Jan 6, 2021

If you visit and click on the Request button, it'll show this message:


We're working on a change soon to redirect users to the appropriate vanity import path.

Copy link

@gopherbot gopherbot commented Jan 6, 2021

Change mentions this issue: internal/frontend: redirect alternative module paths

Copy link

@gopherbot gopherbot commented Jan 6, 2021

Change mentions this issue: content,internal/frontend: add redirect banner for alternative module paths

gopherbot pushed a commit to golang/pkgsite that referenced this issue Jan 6, 2021
When a fetch request reports that a path is an alternative module path,
redirect the user to the canonical path.

For golang/go#43518

Change-Id: I0835a46e8f104ed6c404fa8184578487af55cc54
Trust: Julie Qiu <>
Reviewed-by: Jonathan Amsterdam <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants