зеркало из https://github.com/golang/pkgsite.git
internal/source: support gitee.com and gitlab.*
Add two more patterns to our hard-coded list: - gitee.com is a GitHub look-alike, and links behave the same. - We'll assume any host of the form "gitlab.*" (e.g. "gitlab.ghn.vn") behaves like gitlab.com, which itself behaves like git. Change-Id: I4e4110699086ecd303ec4a4e5a882fb66f36c3b9 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/570673 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Родитель
73f6ca5d21
Коммит
39fa46fd42
|
@ -304,6 +304,15 @@ var patterns = []struct {
|
|||
regexp.MustCompile(`^(?P<repo>gitlab\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)`),
|
||||
githubURLTemplates,
|
||||
},
|
||||
{
|
||||
// Assume that any site beginning "gitlab." works like gitlab.com.
|
||||
regexp.MustCompile(`^(?P<repo>gitlab\.[a-z0-9A-Z.-]+/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(\.git|$)`),
|
||||
githubURLTemplates,
|
||||
},
|
||||
{
|
||||
regexp.MustCompile(`^(?P<repo>gitee\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(\.git|$)`),
|
||||
githubURLTemplates,
|
||||
},
|
||||
|
||||
// Patterns that match the general go command pattern, where they must have
|
||||
// a ".git" repo suffix in an import path. If matching a repo URL from a meta tag,
|
||||
|
|
|
@ -139,7 +139,7 @@ func TestModuleInfo(t *testing.T) {
|
|||
"https://cue.googlesource.com/cue/+/v0.0.9/cuego/doc.go#1",
|
||||
},
|
||||
{
|
||||
"gitlab",
|
||||
"gitlab.com",
|
||||
"gitlab.com/akita/akita", "v1.4.1", "event.go",
|
||||
|
||||
"https://gitlab.com/akita/akita",
|
||||
|
@ -147,6 +147,24 @@ func TestModuleInfo(t *testing.T) {
|
|||
"https://gitlab.com/akita/akita/blob/v1.4.1/event.go",
|
||||
"https://gitlab.com/akita/akita/blob/v1.4.1/event.go#L1",
|
||||
},
|
||||
{
|
||||
"other gitlab",
|
||||
"gitlab.66xue.com/daihao/logkit", "v0.1.18", "color.go",
|
||||
|
||||
"https://gitlab.66xue.com/daihao/logkit",
|
||||
"https://gitlab.66xue.com/daihao/logkit/tree/v0.1.18",
|
||||
"https://gitlab.66xue.com/daihao/logkit/blob/v0.1.18/color.go",
|
||||
"https://gitlab.66xue.com/daihao/logkit/blob/v0.1.18/color.go#L1",
|
||||
},
|
||||
{
|
||||
"gitee.com",
|
||||
"gitee.com/290746987/GenMysqlProject", "v1.0.0", "main.go",
|
||||
|
||||
"https://gitee.com/290746987/GenMysqlProject",
|
||||
"https://gitee.com/290746987/GenMysqlProject/tree/v1.0.0",
|
||||
"https://gitee.com/290746987/GenMysqlProject/blob/v1.0.0/main.go",
|
||||
"https://gitee.com/290746987/GenMysqlProject/blob/v1.0.0/main.go#L1",
|
||||
},
|
||||
{
|
||||
"v2 as a branch",
|
||||
"github.com/jrick/wsrpc/v2", "v2.1.1", "rpc.go",
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче