diff options
Diffstat (limited to 'cmd/godoc/x.go')
-rw-r--r-- | cmd/godoc/x.go | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/cmd/godoc/x.go b/cmd/godoc/x.go index ed7c8d8..f638b68 100644 --- a/cmd/godoc/x.go +++ b/cmd/godoc/x.go @@ -17,19 +17,30 @@ import ( const xPrefix = "/x/" -var xMap = map[string]string{ - "benchmarks": "https://code.google.com/p/go.benchmarks", - "blog": "https://code.google.com/p/go.blog", - "codereview": "https://code.google.com/p/go.codereview", - "crypto": "https://code.google.com/p/go.crypto", - "exp": "https://code.google.com/p/go.exp", - "image": "https://code.google.com/p/go.image", - "mobile": "https://code.google.com/p/go.mobile", - "net": "https://code.google.com/p/go.net", - "sys": "https://code.google.com/p/go.sys", - "talks": "https://code.google.com/p/go.talks", - "text": "https://code.google.com/p/go.text", - "tools": "https://code.google.com/p/go.tools", +type xRepo struct { + URL, VCS string +} + +var xMap = map[string]xRepo{ + "codereview": {"https://code.google.com/p/go.codereview", "hg"}, + + "benchmarks": {"https://go.googlesource.com/benchmarks", "git"}, + "blog": {"https://go.googlesource.com/blog", "git"}, + "build": {"https://go.googlesource.com/build", "git"}, + "crypto": {"https://go.googlesource.com/crypto", "git"}, + "debug": {"https://go.googlesource.com/debug", "git"}, + "exp": {"https://go.googlesource.com/exp", "git"}, + "image": {"https://go.googlesource.com/image", "git"}, + "mobile": {"https://go.googlesource.com/mobile", "git"}, + "net": {"https://go.googlesource.com/net", "git"}, + "oauth2": {"https://go.googlesource.com/oauth2", "git"}, + "playground": {"https://go.googlesource.com/playground", "git"}, + "review": {"https://go.googlesource.com/review", "git"}, + "sys": {"https://go.googlesource.com/sys", "git"}, + "talks": {"https://go.googlesource.com/talks", "git"}, + "text": {"https://go.googlesource.com/text", "git"}, + "tools": {"https://go.googlesource.com/tools", "git"}, + "tour": {"https://go.googlesource.com/tour", "git"}, } func init() { @@ -47,7 +58,8 @@ func xHandler(w http.ResponseWriter, r *http.Request) { return } data := struct { - Prefix, Head, Tail, Repo string + Prefix, Head, Tail string + Repo xRepo }{xPrefix, head, tail, repo} if err := xTemplate.Execute(w, data); err != nil { log.Println("xHandler:", err) @@ -58,7 +70,8 @@ var xTemplate = template.Must(template.New("x").Parse(`<!DOCTYPE html> <html> <head> <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 name="go-source" content="golang.org{{.Prefix}}{{.Head}} https://github.com/golang/{{.Head}}/ https://github.com/golang/{{.Head}}/tree/master{/dir} https://github.com/golang/{{.Head}}/blob/master{/dir}/{file}#L{line}"> <meta http-equiv="refresh" content="0; url=https://godoc.org/golang.org{{.Prefix}}{{.Head}}{{.Tail}}"> </head> <body> |