internal/redirect: add minor fixes from golang.org/x/tools/godoc/redirect
Change-Id: I7436b87c2fd952ad71f25affaf74944b6ec51e6f
Reviewed-on: https://go-review.googlesource.com/c/website/+/293425
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/internal/redirect/redirect.go b/internal/redirect/redirect.go
index 8ae61cb..bcfd6a0 100644
--- a/internal/redirect/redirect.go
+++ b/internal/redirect/redirect.go
@@ -156,7 +156,7 @@
})
}
-var validId = regexp.MustCompile(`^[A-Za-z0-9-]*/?$`)
+var validID = regexp.MustCompile(`^[A-Za-z0-9-]*/?$`)
func PrefixHandler(prefix, baseURL string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -166,7 +166,7 @@
return
}
id := r.URL.Path[len(prefix):]
- if !validId.MatchString(id) {
+ if !validID.MatchString(id) {
http.Error(w, "Not found", http.StatusNotFound)
return
}
@@ -192,7 +192,7 @@
id := r.URL.Path[len(prefix):]
// support /cl/152700045/, which is used in commit 0edafefc36.
id = strings.TrimSuffix(id, "/")
- if !validId.MatchString(id) {
+ if !validID.MatchString(id) {
http.Error(w, "Not found", http.StatusNotFound)
return
}
diff --git a/internal/redirect/redirect_test.go b/internal/redirect/redirect_test.go
index 804bfb0..756c0d0 100644
--- a/internal/redirect/redirect_test.go
+++ b/internal/redirect/redirect_test.go
@@ -68,7 +68,7 @@
"/cl/152047": {302, "https://go-review.googlesource.com/152047"},
"/cl/152048": {302, "https://codereview.appspot.com/152048"},
- // And verify we're using the the "bigEnoughAssumeRietveld" value:
+ // And verify we're using the "bigEnoughAssumeRietveld" value:
"/cl/299999": {302, "https://go-review.googlesource.com/299999"},
"/cl/300000": {302, "https://codereview.appspot.com/300000"},
}