go.tools/godoc: deal with fallout from $GOROOT/src/pkg -> $GOROOT/src renaming.
To avoid breaking URLs, we redirect /src/pkg/* to /src/*.
The URL /pkg is now the "directory" /src, which triggers the
"Packages" index.
All other references to "src/pkg" are now gone,
except a number in the namespace documentation which are
probably still illustrative.
Tested: go test cmd/godoc godoc
Manual inspection of src and src/pkg pages.
with GOROOT and GOPATH packages
-analysis
/AUTHORS file URL still works
LGTM=bradfitz, adg
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/141770044
diff --git a/godoc/server.go b/godoc/server.go
index 900f9b7..e81c673 100644
--- a/godoc/server.go
+++ b/godoc/server.go
@@ -253,7 +253,7 @@
// special cases for top-level package/command directories
switch tabtitle {
- case "/src/pkg":
+ case "/src":
title = "Packages"
tabtitle = "Packages"
case "/src/cmd":
@@ -262,7 +262,6 @@
}
// Emit JSON array for type information.
- // TODO(adonovan): display the h.c.Analysis.Status() message in the UI.
pi := h.c.Analysis.PackageInfo(relpath)
info.CallGraphIndex = pi.CallGraphIndex
info.CallGraph = htmltemplate.JS(marshalJSON(pi.CallGraph))
@@ -501,7 +500,7 @@
var buf bytes.Buffer
if pathpkg.Ext(abspath) == ".go" {
- // Find markup links for this file (e.g. "/src/pkg/fmt/print.go").
+ // Find markup links for this file (e.g. "/src/fmt/print.go").
fi := p.Corpus.Analysis.FileInfo(abspath)
buf.WriteString("<script type='text/javascript'>document.ANALYSIS_DATA = ")
buf.Write(marshalJSON(fi.Data))