diff --git a/lib/manager/gomod/update.js b/lib/manager/gomod/update.js index 2c5fae4c95b8f89c1aaf08204fa17f464d4ea626..02b24388c2fa61a848470d42282595ca952e7ad5 100644 --- a/lib/manager/gomod/update.js +++ b/lib/manager/gomod/update.js @@ -5,8 +5,9 @@ module.exports = { }; function updateDependency(currentFileContent, upgrade) { + const { depName } = upgrade; try { - const depNameNoVersion = upgrade.depName + const depNameNoVersion = depName .split('/') .slice(0, 3) .join('/'); @@ -17,6 +18,10 @@ function updateDependency(currentFileContent, upgrade) { !lineToChange.includes(depNameNoVersion) && !lineToChange.includes('rethinkdb/rethinkdb-go.v5') ) { + logger.debug( + { lineToChange, depName }, + "go.mod current line doesn't contain dependency" + ); return null; } let requireLine; @@ -45,8 +50,8 @@ function updateDependency(currentFileContent, upgrade) { newLine = lineToChange.replace(requireLine, `$1$2${upgrade.newValue}`); } if (upgrade.updateType === 'major') { - if (upgrade.depName.startsWith('gopkg.in/')) { - const oldV = upgrade.depName.split('.').pop(); + if (depName.startsWith('gopkg.in/')) { + const oldV = depName.split('.').pop(); newLine = newLine.replace(`.${oldV}`, `.v${upgrade.newMajor}`); // Package renames - I couldn't think of a better place to do this newLine = newLine.replace(