格式
go get -u gitlab.firecloud.wan/group/subgroup/project/pkg
Nginx配置
location ~ (^\/fc-xdr)|(^\/fc-center)|(^\/fc-tic)|(^\/web-frame){ if ($args ~* "^go-get=1") { proxy_pass http://192.168.110.223:4801; } proxy_cache gitlab; proxy_pass http://gitlab-workhorse; }
重写Go Get Meta信息
package main
import (
"fmt"
"strings"
"github.com/gin-gonic/gin"
)
const (
RESULT = "<!DOCTYPE html><html><head><meta content='gitlab.firecloud.wan%s git ssh://git@gitlab.firecloud.wan%s.git' name='go-import'></head></html>"
)
func main() {
r := gin.Default()
r.GET("/*uri", func(c *gin.Context) {
uri := c.Param("uri")
goProjectPath := strings.Split(uri, "/")
if len(goProjectPath) < 4 {
return
}
c.Header("Content-Type", "application/json; charset=utf-8")
path := strings.Join(goProjectPath[:4], "/")
ret := fmt.Sprintf(RESULT, path, path)
c.String(200, ret)
})
r.Run(":4801")
}