From 114dbff3bd8105bd8e85dfaff01b0961ec891e1d Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Tue, 30 Nov 2021 13:45:48 +0900 Subject: [PATCH] fix github links for +incompatible versions --- check/utils.go | 4 ++++ check/utils_test.go | 1 + 2 files changed, 5 insertions(+) diff --git a/check/utils.go b/check/utils.go index 337d28b..9e19c9a 100644 --- a/check/utils.go +++ b/check/utils.go @@ -251,6 +251,10 @@ func fileURL(dir, filename string) string { ver = strings.Split(ver, "-")[2] } + if strings.Contains(ver, "+incompatible") { + ver = strings.TrimSuffix(ver, "+incompatible") + } + return fmt.Sprintf("https://%s/blob/%s/%s", base, ver, f) } diff --git a/check/utils_test.go b/check/utils_test.go index 57ceacc..e1de713 100644 --- a/check/utils_test.go +++ b/check/utils_test.go @@ -71,6 +71,7 @@ func TestFileURL(t *testing.T) { }{ {"_repos/src/github.com/foo/testrepo@v0.1.0/bar/baz.go", "/github.com/foo/testrepo@v0.1.0/bar/baz.go", "https://github.com/foo/testrepo/blob/v0.1.0/bar/baz.go"}, {"_repos/src/github.com/foo/testrepo@v0.0.0-20211126063219-a5e10ccf946a/bar/baz.go", "/github.com/foo/testrepo@v0.0.0-20211126063219-a5e10ccf946a/bar/baz.go", "https://github.com/foo/testrepo/blob/a5e10ccf946a/bar/baz.go"}, + {"_repos/src/github.com/foo/testrepo@v20.10.11+incompatible/bar/baz.go", "/github.com/foo/testrepo@v20.10.11+incompatible/bar/baz.go", "https://github.com/foo/testrepo/blob/v20.10.11/bar/baz.go"}, } for _, tt := range cases {