Skip to content

Commit

Permalink
fix(gomod): use plural for additional dependencies notice (#29361)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunet committed May 30, 2024
1 parent 27b08bc commit d81b2c5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
24 changes: 23 additions & 1 deletion lib/modules/manager/gomod/artifacts-extra.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('modules/manager/gomod/artifacts-extra', () => {
expect(res).toBeNull();
});

it('returns a notice when there are extra dependencies', () => {
it('returns a notice when there is an extra dependency', () => {
const excludeDeps = ['go', 'github.com/foo/foo'];

const res = getExtraDepsNotice(goModBefore, goModAfter, excludeDeps);
Expand All @@ -112,6 +112,28 @@ describe('modules/manager/gomod/artifacts-extra', () => {
);
});

it('returns a notice when there are extra dependencies', () => {
const excludeDeps = ['go'];

const res = getExtraDepsNotice(goModBefore, goModAfter, excludeDeps);

expect(res).toEqual(
[
'In order to perform the update(s) described in the table above, Renovate ran the `go get` command, which resulted in the following additional change(s):',
'',
'',
'- 2 additional dependencies were updated',
'',
'',
'Details:',
'| **Package** | **Change** |',
'| :------------------- | :------------------- |',
'| `github.com/foo/foo` | `v1.0.0` -> `v1.1.1` |',
'| `github.com/bar/bar` | `v2.0.0` -> `v2.2.2` |',
].join('\n'),
);
});

it('adds special notice for updated `go` version', () => {
const excludeDeps = ['github.com/foo/foo'];

Expand Down
6 changes: 5 additions & 1 deletion lib/modules/manager/gomod/artifacts-extra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ export function getExtraDepsNotice(
const goUpdated = extraDeps.some(({ depName }) => depName === 'go');
const otherDepsCount = extraDeps.length - (goUpdated ? 1 : 0);

if (otherDepsCount > 0) {
if (otherDepsCount === 1) {
noticeLines.push(`- ${otherDepsCount} additional dependency was updated`);
} else if (otherDepsCount > 1) {
noticeLines.push(
`- ${otherDepsCount} additional dependencies were updated`,
);
}

if (goUpdated) {
Expand Down

0 comments on commit d81b2c5

Please sign in to comment.