diff --git a/lib/modules/datasource/go/__fixtures__/go-get-submodule-gitlab.html b/lib/modules/datasource/go/__fixtures__/go-get-submodule-gitlab.html new file mode 100644 index 00000000000000..42c532d935f343 --- /dev/null +++ b/lib/modules/datasource/go/__fixtures__/go-get-submodule-gitlab.html @@ -0,0 +1,8 @@ + + +
+ + + + go get https://gitlab.com/example/module + diff --git a/lib/modules/datasource/go/base.spec.ts b/lib/modules/datasource/go/base.spec.ts index b03aced9ddc73a..df89482641ce3a 100644 --- a/lib/modules/datasource/go/base.spec.ts +++ b/lib/modules/datasource/go/base.spec.ts @@ -117,6 +117,23 @@ describe('modules/datasource/go/base', () => { }); }); + it('supports Go submodules in GitLab repo', async () => { + httpMock + .scope('https://gitlab.com') + .get('/example/module/submodule?go-get=1') + .reply(200, Fixtures.get('go-get-submodule-gitlab.html')); + + const res = await BaseGoDatasource.getDatasource( + 'gitlab.com/example/module/submodule', + ); + + expect(res).toEqual({ + datasource: GitlabTagsDatasource.id, + packageName: 'example/module', + registryUrl: 'https://gitlab.com', + }); + }); + it('supports GitLab deps', async () => { httpMock .scope('https://gitlab.com') @@ -163,7 +180,7 @@ describe('modules/datasource/go/base', () => { expect(res).toEqual({ datasource: GitlabTagsDatasource.id, - packageName: 'group/subgroup/my.git.module', + packageName: 'group/subgroup', registryUrl: 'https://gitlab.com', }); }); diff --git a/lib/modules/datasource/go/base.ts b/lib/modules/datasource/go/base.ts index 9a2087a200f010..fc9a3cd906b83e 100644 --- a/lib/modules/datasource/go/base.ts +++ b/lib/modules/datasource/go/base.ts @@ -21,9 +21,6 @@ export class BaseGoDatasource { private static readonly gitlabHttpsRegExp = regEx( /^(?