godoc: Strip "/src/pkg/" prefix from identifier keys, so that it's keyed identically to import count.
Intern the documentation strings.
LGTM=sameer
R=sameer, bradfitz
CC=golang-codereviews
https://golang.org/cl/107250043
diff --git a/godoc/godoc_test.go b/godoc/godoc_test.go
index 76ce946..37e1d71 100644
--- a/godoc/godoc_test.go
+++ b/godoc/godoc_test.go
@@ -14,7 +14,9 @@
want string
}{
{"/src/pkg/fmt", "pkg/fmt"},
+ {"src/pkg/fmt", "pkg/fmt"},
{"/fmt", "pkg/fmt"},
+ {"fmt", "pkg/fmt"},
} {
if got := pkgLinkFunc(tc.path); got != tc.want {
t.Errorf("pkgLinkFunc(%v) = %v; want %v", tc.path, got, tc.want)
@@ -84,8 +86,8 @@
ident string
want string
}{
- {"/src/pkg/fmt", "Sprintf", "/pkg/fmt/#Sprintf"},
- {"/src/pkg/fmt", "EOF", "/pkg/fmt/#EOF"},
+ {"fmt", "Sprintf", "/pkg/fmt/#Sprintf"},
+ {"fmt", "EOF", "/pkg/fmt/#EOF"},
} {
if got := docLinkFunc(tc.src, tc.ident); got != tc.want {
t.Errorf("docLinkFunc(%v, %v) = %v; want %v", tc.src, tc.ident, got, tc.want)