diff --git a/lib/datasource/go/get-datasource.spec.ts b/lib/datasource/go/get-datasource.spec.ts index 66290eb8ec7b100dfa706ac6c6466d190390d1b5..530cef6ef7635507d6cf13f5e98d1f14e5e7e173 100644 --- a/lib/datasource/go/get-datasource.spec.ts +++ b/lib/datasource/go/get-datasource.spec.ts @@ -88,6 +88,7 @@ describe('datasource/go/get-datasource', () => { expect(res).toEqual({ datasource: githubDatasource, lookupName: 'golang/text', + registryUrl: 'https://github.com', }); }); diff --git a/lib/datasource/go/get-datasource.ts b/lib/datasource/go/get-datasource.ts index cf4a818da9d5b618d095eae4afbcbaf0fead01fd..653e060fb70986da54e63efa3641a2652c467e91 100644 --- a/lib/datasource/go/get-datasource.ts +++ b/lib/datasource/go/get-datasource.ts @@ -35,6 +35,7 @@ async function goGetDatasource(goModule: string): Promise<DataSource | null> { lookupName: goSourceUrl .replace('https://github.com/', '') .replace(regEx(/\/$/), ''), + registryUrl: 'https://github.com', }; } const gitlabUrl = @@ -129,7 +130,11 @@ export async function getDatasource( if (goModule.startsWith('gopkg.in/')) { const [pkg] = goModule.replace('gopkg.in/', '').split('.'); const lookupName = pkg.includes('/') ? pkg : `go-${pkg}/${pkg}`; - return { datasource: github.id, lookupName }; + return { + datasource: github.id, + lookupName, + registryUrl: 'https://github.com', + }; } if (goModule.startsWith('github.com/')) { @@ -138,6 +143,7 @@ export async function getDatasource( return { datasource: github.id, lookupName, + registryUrl: 'https://github.com', }; } @@ -147,6 +153,7 @@ export async function getDatasource( return { datasource: bitbucket.id, lookupName, + registryUrl: 'https://bitbucket.org', }; } diff --git a/lib/datasource/go/releases-direct.spec.ts b/lib/datasource/go/releases-direct.spec.ts index ff1c6676f6d109d8bff380ebf624a267527ae25f..5f0e2a10cade0a412e9512a484a4048fa9efe320 100644 --- a/lib/datasource/go/releases-direct.spec.ts +++ b/lib/datasource/go/releases-direct.spec.ts @@ -42,6 +42,7 @@ describe('datasource/go/releases-direct', () => { ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'golang/text', + registryUrl: 'https://github.com', }); httpMock .scope('https://api.github.com/') @@ -98,6 +99,7 @@ describe('datasource/go/releases-direct', () => { ds.getDatasource.mockResolvedValueOnce({ datasource: 'bitbucket-tags', lookupName: 'golang/text', + registryUrl: 'https://bitbucket.org', }); httpMock .scope('https://api.bitbucket.org/') @@ -139,14 +141,17 @@ describe('datasource/go/releases-direct', () => { ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'go-x/x', + registryUrl: 'https://github.com', }); httpMock .scope('https://api.github.com/') @@ -199,14 +204,17 @@ describe('datasource/go/releases-direct', () => { ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); const packages = [ { lookupName: 'github.com/x/text/a' }, @@ -236,10 +244,12 @@ describe('datasource/go/releases-direct', () => { ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); const packages = [ { lookupName: 'github.com/x/text/a' }, @@ -267,6 +277,7 @@ describe('datasource/go/releases-direct', () => { ds.getDatasource.mockResolvedValueOnce({ datasource: 'github-tags', lookupName: 'x/text', + registryUrl: 'https://github.com', }); const pkg = { lookupName: 'github.com/x/text/b/v2' }; const tags = [ diff --git a/lib/datasource/go/types.ts b/lib/datasource/go/types.ts index 8eabe0696c0bdc00f36aec604035e7b4e96ac0b1..329e09493b5d8fd9466050734c40b094d345b0fc 100644 --- a/lib/datasource/go/types.ts +++ b/lib/datasource/go/types.ts @@ -2,7 +2,7 @@ import type { GoproxyFallback } from './common'; export interface DataSource { datasource: string; - registryUrl?: string; + registryUrl: string; lookupName: string; }