Skip to content

Commit

Permalink
fix(datasource/go): Remove .git/v2 in go package name to retrieve it …
Browse files Browse the repository at this point in the history
…correctly (#27569)
  • Loading branch information
ManuelB committed Feb 27, 2024
1 parent ea0f044 commit 8706b77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/modules/datasource/go/base.spec.ts
Expand Up @@ -260,7 +260,7 @@ describe('modules/datasource/go/base', () => {
hostRules.hostType.mockReturnValue('gitlab');
httpMock
.scope('https://my.custom.domain')
.get('/golang/subgroup/myrepo.git/v2?go-get=1')
.get('/golang/subgroup/myrepo?go-get=1')
.reply(200, Fixtures.get('go-get-gitlab-ee-private-subgroup.html'));

const res = await BaseGoDatasource.getDatasource(
Expand Down
3 changes: 2 additions & 1 deletion lib/modules/datasource/go/base.ts
Expand Up @@ -77,7 +77,8 @@ export class BaseGoDatasource {
private static async goGetDatasource(
goModule: string,
): Promise<DataSource | null> {
const pkgUrl = `https://${goModule}?go-get=1`;
const goModuleUrl = goModule.replace(/\.git\/v2$/, '');
const pkgUrl = `https://${goModuleUrl}?go-get=1`;
// GitHub Enterprise only returns a go-import meta
const res = (await BaseGoDatasource.http.get(pkgUrl)).body;
return (
Expand Down

0 comments on commit 8706b77

Please sign in to comment.