diff --git a/lib/modules/datasource/go/base.spec.ts b/lib/modules/datasource/go/base.spec.ts index c2d2c0c468ff2cae6174e645f3736f48239a9d66..517cb5d811ec566043237aa21f27b690d9435892 100644 --- a/lib/modules/datasource/go/base.spec.ts +++ b/lib/modules/datasource/go/base.spec.ts @@ -1,6 +1,7 @@ import { Fixtures } from '../../../../test/fixtures'; import * as httpMock from '../../../../test/http-mock'; import { mocked } from '../../../../test/util'; +import { PlatformId } from '../../../constants'; import * as _hostRules from '../../../util/host-rules'; import { GithubTagsDatasource } from '../github-tags'; import { GitlabTagsDatasource } from '../gitlab-tags'; @@ -202,7 +203,7 @@ describe('modules/datasource/go/base', () => { }); it('supports GitLab EE deps', async () => { - hostRules.find.mockReturnValue({ token: 'some-token' }); + hostRules.hostType.mockReturnValue(PlatformId.Gitlab); httpMock .scope('https://my.custom.domain') .get('/golang/myrepo?go-get=1') @@ -220,7 +221,7 @@ describe('modules/datasource/go/base', () => { }); it('supports GitLab EE deps in subgroup', async () => { - hostRules.find.mockReturnValue({ token: 'some-token' }); + hostRules.hostType.mockReturnValue(PlatformId.Gitlab); httpMock .scope('https://my.custom.domain') .get('/golang/subgroup/myrepo?go-get=1') @@ -238,7 +239,7 @@ describe('modules/datasource/go/base', () => { }); it('supports GitLab EE deps in subgroup with version', async () => { - hostRules.find.mockReturnValue({ token: 'some-token' }); + hostRules.hostType.mockReturnValue(PlatformId.Gitlab); httpMock .scope('https://my.custom.domain') .get('/golang/subgroup/myrepo/v2?go-get=1') @@ -256,7 +257,7 @@ describe('modules/datasource/go/base', () => { }); it('supports GitLab EE deps in private subgroup with vcs indicator', async () => { - hostRules.find.mockReturnValue({ token: 'some-token' }); + hostRules.hostType.mockReturnValue(PlatformId.Gitlab); httpMock .scope('https://my.custom.domain') .get('/golang/subgroup/myrepo.git/v2?go-get=1') @@ -274,7 +275,7 @@ describe('modules/datasource/go/base', () => { }); it('supports GitLab EE monorepo deps in subgroup', async () => { - hostRules.find.mockReturnValue({ token: 'some-token' }); + hostRules.hostType.mockReturnValue(PlatformId.Gitlab); httpMock .scope('https://my.custom.domain') .get('/golang/subgroup/myrepo/monorepo?go-get=1') diff --git a/lib/modules/datasource/go/base.ts b/lib/modules/datasource/go/base.ts index 8c75bb0709d95c1fb0c6fec8c67f904abbd30055..4e8f00ff83481d1ace028e117c807f63ed0eb831 100644 --- a/lib/modules/datasource/go/base.ts +++ b/lib/modules/datasource/go/base.ts @@ -137,11 +137,7 @@ export class BaseGoDatasource { }; } - const opts = hostRules.find({ - hostType: PlatformId.Gitlab, - url: goSourceUrl, - }); - if (opts.token) { + if (hostRules.hostType({ url: goSourceUrl }) === PlatformId.Gitlab) { // get server base url from import url const parsedUrl = URL.parse(goSourceUrl);