x/tools/cmd/godoc: add golang.org/x/review custom import path
LGTM=r R=r CC=golang-codereviews https://golang.org/cl/174410043
This commit is contained in:
parent
a3be5384d5
commit
1536a92c03
|
|
@ -17,19 +17,25 @@ import (
|
||||||
|
|
||||||
const xPrefix = "/x/"
|
const xPrefix = "/x/"
|
||||||
|
|
||||||
var xMap = map[string]string{
|
type xRepo struct {
|
||||||
"benchmarks": "https://code.google.com/p/go.benchmarks",
|
URL, VCS string
|
||||||
"blog": "https://code.google.com/p/go.blog",
|
}
|
||||||
"codereview": "https://code.google.com/p/go.codereview",
|
|
||||||
"crypto": "https://code.google.com/p/go.crypto",
|
var xMap = map[string]xRepo{
|
||||||
"exp": "https://code.google.com/p/go.exp",
|
"benchmarks": {"https://code.google.com/p/go.benchmarks", "hg"},
|
||||||
"image": "https://code.google.com/p/go.image",
|
"blog": {"https://code.google.com/p/go.blog", "hg"},
|
||||||
"mobile": "https://code.google.com/p/go.mobile",
|
"codereview": {"https://code.google.com/p/go.codereview", "hg"},
|
||||||
"net": "https://code.google.com/p/go.net",
|
"crypto": {"https://code.google.com/p/go.crypto", "hg"},
|
||||||
"sys": "https://code.google.com/p/go.sys",
|
"exp": {"https://code.google.com/p/go.exp", "hg"},
|
||||||
"talks": "https://code.google.com/p/go.talks",
|
"image": {"https://code.google.com/p/go.image", "hg"},
|
||||||
"text": "https://code.google.com/p/go.text",
|
"mobile": {"https://code.google.com/p/go.mobile", "hg"},
|
||||||
"tools": "https://code.google.com/p/go.tools",
|
"net": {"https://code.google.com/p/go.net", "hg"},
|
||||||
|
"sys": {"https://code.google.com/p/go.sys", "hg"},
|
||||||
|
"talks": {"https://code.google.com/p/go.talks", "hg"},
|
||||||
|
"text": {"https://code.google.com/p/go.text", "hg"},
|
||||||
|
"tools": {"https://code.google.com/p/go.tools", "hg"},
|
||||||
|
|
||||||
|
"review": {"https://go.googlecode.com/review", "git"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -47,7 +53,8 @@ func xHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data := struct {
|
data := struct {
|
||||||
Prefix, Head, Tail, Repo string
|
Prefix, Head, Tail string
|
||||||
|
Repo xRepo
|
||||||
}{xPrefix, head, tail, repo}
|
}{xPrefix, head, tail, repo}
|
||||||
if err := xTemplate.Execute(w, data); err != nil {
|
if err := xTemplate.Execute(w, data); err != nil {
|
||||||
log.Println("xHandler:", err)
|
log.Println("xHandler:", err)
|
||||||
|
|
@ -58,7 +65,7 @@ var xTemplate = template.Must(template.New("x").Parse(`<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<meta name="go-import" content="golang.org{{.Prefix}}{{.Head}} hg {{.Repo}}">
|
<meta name="go-import" content="golang.org{{.Prefix}}{{.Head}} {{.Repo.VCS}} {{.Repo.URL}}">
|
||||||
<meta http-equiv="refresh" content="0; url=https://godoc.org/golang.org{{.Prefix}}{{.Head}}{{.Tail}}">
|
<meta http-equiv="refresh" content="0; url=https://godoc.org/golang.org{{.Prefix}}{{.Head}}{{.Tail}}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue