x/pkgsite: suggest canonical module/package path when visiting repository path #43518
Labels
Milestone
Comments
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. |
If you visit https://pkg.go.dev/github.com/rsc/rf and click on the We're working on a change soon to redirect users to the appropriate vanity import path. |
Change https://golang.org/cl/281872 mentions this issue: |
Change https://golang.org/cl/281678 mentions this issue: |
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 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/281872 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was recently browsing https://github.com/rsc/rf and wanted to see its godoc so I naively visited https://pkg.go.dev/github.com/rsc/rf. This presented me with the
Oops! We couldn't find “github.com/rsc/rf”.
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 rsc.io/rf. Visiting https://pkg.go.dev/rsc.io/rf then worked as expected.
It would be nice if pkgsite suggested visiting https://pkg.go.dev/rsc.io/rf to me when visiting https://pkg.go.dev/github.com/rsc/rf. It seems to already know that rsc.io/rf comes from github.com/rsc/rf as part of linking github.com/rsc/rf under "Repository" at https://pkg.go.dev/rsc.io/rf.
This would also align with what happens when trying to
go get github.com/rsc/rf
in an existing module, which does suggest the canonical path:The text was updated successfully, but these errors were encountered: