golang/gddo — pull request #203 by garyburd (2014-11-06 21:18:47+00:00)
Title: Implement package redirects.

Add feature to redirect page requests for a non-canonical package path
to the canonical package path. This feature covers the following
scenarios:

- Non-canonical case used in GitHub user and repository names.
- Package import comments as described at http://goo.gl/MBL1n6.
- New Go sub-repository names as described at http://goo.gl/wPoqC5.

Packages at non-canonical paths are deleted from the database the next
time they are crawled.

Specific changes to the code are:

- Code in gddd-server/main.go used pdoc == nil to indicate that a
package was not found. Update the code to use gosrc.NotFoundError to
indicate that the package was not found.
- Add Redirect field to gosrc.NotFoundError. This field specifies the
canonical path for a package if known.
- Update the code to set the gosrc.NotFoundError Redirect field as
appropriate.
- Update the document page and refresh to redirect as appropriate. The
API does not redirect.
- Update the sub-repo page (http://godoc.org/-/subrepo) and supporting
indexing code for the new Go sub-repository names.

The package import comment feature is commented out because the feature
depends on Go 1.4.