diff --git a/modules/base/base.go b/modules/base/base.go
index 84cf41c8d..3e80a436e 100644
--- a/modules/base/base.go
+++ b/modules/base/base.go
@@ -54,3 +54,5 @@ const (
BindingBooleanTypeError string = "BooleanTypeError"
BindingFloatTypeError string = "FloatTypeError"
)
+
+var GoGetMetas = make(map[string]bool)
diff --git a/modules/base/template.go b/modules/base/template.go
index 624149796..863bd89e8 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -197,3 +197,15 @@ func DiffLineTypeToStr(diffType int) string {
}
return "same"
}
+
+const (
+ TPL_GO_GET_META = ``
+)
+
+func GetGoGetMetaList() []byte {
+ buf := bytes.NewBuffer([]byte(""))
+ for meta := range GoGetMetas {
+ buf.WriteString(fmt.Sprintf(TPL_GO_GET_META, Domain, meta))
+ }
+ return buf.Bytes()
+}
diff --git a/routers/dashboard.go b/routers/dashboard.go
index 2c81cf23c..12635412a 100644
--- a/routers/dashboard.go
+++ b/routers/dashboard.go
@@ -11,6 +11,11 @@ import (
)
func Home(ctx *middleware.Context) {
+ if ctx.Query("go-get") == "1" {
+ ctx.Write(base.GetGoGetMetaList())
+ return
+ }
+
if ctx.IsSigned {
user.Dashboard(ctx)
return
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index dda26899d..a7088d555 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -107,6 +107,10 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
}
func Single(ctx *middleware.Context, params martini.Params) {
+ if ctx.Query("go-get") == "1" {
+ base.GoGetMetas[strings.TrimSuffix(ctx.Repo.CloneLink.HTTPS, ".git")] = true
+ }
+
branchName := ctx.Repo.BranchName
userName := ctx.Repo.Owner.Name
repoName := ctx.Repo.Repository.Name
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 441fd542d..1d63b4663 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -9,7 +9,7 @@
-
+
{{if IsProdMode}}