From 1536a92c033ea2a264b5432bc56acb96a58fb11e Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Wed, 19 Nov 2014 14:03:19 +1100 Subject: [PATCH] x/tools/cmd/godoc: add golang.org/x/review custom import path LGTM=r R=r CC=golang-codereviews https://golang.org/cl/174410043 --- cmd/godoc/x.go | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/cmd/godoc/x.go b/cmd/godoc/x.go index ed7c8d8a..1e609fbc 100644 --- a/cmd/godoc/x.go +++ b/cmd/godoc/x.go @@ -17,19 +17,25 @@ 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{ + "benchmarks": {"https://code.google.com/p/go.benchmarks", "hg"}, + "blog": {"https://code.google.com/p/go.blog", "hg"}, + "codereview": {"https://code.google.com/p/go.codereview", "hg"}, + "crypto": {"https://code.google.com/p/go.crypto", "hg"}, + "exp": {"https://code.google.com/p/go.exp", "hg"}, + "image": {"https://code.google.com/p/go.image", "hg"}, + "mobile": {"https://code.google.com/p/go.mobile", "hg"}, + "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() { @@ -47,7 +53,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 +65,7 @@ var xTemplate = template.Must(template.New("x").Parse(` - +