Skip to content

Commit

Permalink
feat(go): Add support for Go host code.cloudfoundry.org (#25173)
Browse files Browse the repository at this point in the history
  • Loading branch information
silvestre committed Oct 13, 2023
1 parent df273f7 commit 9c8e6ac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/modules/datasource/go/base.spec.ts
Expand Up @@ -15,11 +15,12 @@ const hostRules = mocked(_hostRules);
describe('modules/datasource/go/base', () => {
describe('simple cases', () => {
it.each`
module | datasource | packageName
${'gopkg.in/foo'} | ${'github-tags'} | ${'go-foo/foo'}
${'gopkg.in/foo/bar'} | ${'github-tags'} | ${'foo/bar'}
${'github.com/foo/bar'} | ${'github-tags'} | ${'foo/bar'}
${'bitbucket.org/foo/bar'} | ${'bitbucket-tags'} | ${'foo/bar'}
module | datasource | packageName
${'gopkg.in/foo'} | ${'github-tags'} | ${'go-foo/foo'}
${'gopkg.in/foo/bar'} | ${'github-tags'} | ${'foo/bar'}
${'github.com/foo/bar'} | ${'github-tags'} | ${'foo/bar'}
${'bitbucket.org/foo/bar'} | ${'bitbucket-tags'} | ${'foo/bar'}
${'code.cloudfoundry.org/lager'} | ${'github-tags'} | ${'cloudfoundry/lager'}
`(
'$module -> $datasource: $packageName',
async ({ module, datasource, packageName }) => {
Expand Down
12 changes: 12 additions & 0 deletions lib/modules/datasource/go/base.ts
Expand Up @@ -58,6 +58,18 @@ export class BaseGoDatasource {
};
}

if (goModule.startsWith('code.cloudfoundry.org/')) {
const packageName = goModule.replace(
'code.cloudfoundry.org',
'cloudfoundry'
);
return {
datasource: GithubTagsDatasource.id,
packageName,
registryUrl: 'https://github.com',
};
}

return await BaseGoDatasource.goGetDatasource(goModule);
}

Expand Down

0 comments on commit 9c8e6ac

Please sign in to comment.