Skip to content

Commit

Permalink
chore(gomod): better update failure logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Aug 24, 2023
1 parent 53e3deb commit acdd430
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/modules/manager/gomod/update.ts
Expand Up @@ -28,6 +28,11 @@ export function updateDependency({
}
const depNameNoVersion = getDepNameWithNoVersion(depName);
const lines = fileContent.split(newlineRegex);
// istanbul ignore if: hard to test
if (lines.length <= upgrade.managerData.lineNumber) {
logger.warn('go.mod current line no longer exists after update');
return null;
}
const lineToChange = lines[upgrade.managerData.lineNumber];
if (
!lineToChange.includes(depNameNoVersion) &&
Expand Down

0 comments on commit acdd430

Please sign in to comment.