Skip to content
Snippets Groups Projects
Unverified Commit e64739ce authored by Maxime Brunet's avatar Maxime Brunet Committed by GitHub
Browse files

fix(gomod): avoid duplicating "incompatible" metadata (#17867)

parent 95339bde
No related branches found
Tags 36.52.3
No related merge requests found
......@@ -259,6 +259,23 @@ describe('modules/manager/gomod/update', () => {
);
});
it('handles +incompatible tag without duplicating it', () => {
const upgrade = {
depName: 'github.com/Azure/azure-sdk-for-go',
managerData: { lineNumber: 8 },
newValue: 'v26.0.0+incompatible',
depType: 'require',
};
const res = updateDependency({ fileContent: gomod1, upgrade });
expect(res).not.toEqual(gomod1);
expect(res).not.toContain(
'github.com/Azure/azure-sdk-for-go v26.0.0+incompatible+incompatible'
);
expect(res).toContain(
'github.com/Azure/azure-sdk-for-go v26.0.0+incompatible'
);
});
it('handles replace line with minor version update', () => {
const upgrade = {
depName: 'github.com/pravesht/gocql',
......
......@@ -120,7 +120,10 @@ export function updateDependency({
}
}
}
if (lineToChange.endsWith('+incompatible')) {
if (
lineToChange.endsWith('+incompatible') &&
!upgrade.newValue?.endsWith('+incompatible')
) {
let toAdd = '+incompatible';
if (upgrade.updateType === 'major' && upgrade.newMajor! >= 2) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment