[release-branch.go1.8] x/tools/godoc: fix redirect to Gerrit
Redirects to /r/NNNN broke due to crbug.com/gerrit/6888.
Alternative URLs are available in the meantime: /NNNN and /c/NNNN.
This change uses the /NNNN format.
Fixes golang/go#21235
Change-Id: Ie30e01bedd7a8277aedd4070b5f82a754521ed03
Reviewed-on: https://go-review.googlesource.com/52150
Reviewed-by: Kevin Burke <kev@inburke.com>
Reviewed-on: https://go-review.googlesource.com/52170
Reviewed-by: Andrew Bonventre <andybons@golang.org>
diff --git a/godoc/redirect/redirect.go b/godoc/redirect/redirect.go
index b07d97f..01ab425 100644
--- a/godoc/redirect/redirect.go
+++ b/godoc/redirect/redirect.go
@@ -196,7 +196,7 @@
if n, err := strconv.Atoi(id); err == nil && n > 150000 {
target = "https://codereview.appspot.com/" + id
} else {
- target = "https://go-review.googlesource.com/r/" + id
+ target = "https://go-review.googlesource.com/" + id
}
http.Redirect(w, r, target, http.StatusFound)
}
diff --git a/godoc/redirect/redirect_test.go b/godoc/redirect/redirect_test.go
index 5e8045a..21c6dae 100644
--- a/godoc/redirect/redirect_test.go
+++ b/godoc/redirect/redirect_test.go
@@ -55,8 +55,8 @@
"/design/123-foo": {302, "https://github.com/golang/proposal/blob/master/design/123-foo.md"},
"/design/text/123-foo": {302, "https://github.com/golang/proposal/blob/master/design/text/123-foo.md"},
- "/cl/1": {302, "https://go-review.googlesource.com/r/1"},
- "/cl/1/": {302, "https://go-review.googlesource.com/r/1"},
+ "/cl/1": {302, "https://go-review.googlesource.com/1"},
+ "/cl/1/": {302, "https://go-review.googlesource.com/1"},
"/cl/267120043": {302, "https://codereview.appspot.com/267120043"},
"/cl/267120043/": {302, "https://codereview.appspot.com/267120043"},
}