doc: don't redirect vanity packages to GitHub

This change fixes a regression from CL 120059. We started to redirect
to GitHub's reported canonical case when the request path didn't
match too aggressively. It should only be done if the request path is
already on GitHub; otherwise we're redirecting a vanity import path to
its GitHub hosting location whenever it doesn't have an import path

Add tests for this newPackage redirection behavior to increase
confidence in the fix, and help avoid future regressions.

Fix typos in gosrc package comments.

Fixes golang/gddo#579.

Change-Id: I7ed0787a125d2f39ca979d01983e971729e181fd
Reviewed-by: Tuo Shan <>
4 files changed