fix(gomod): no infinite major updates

This commit is contained in:
Rhys Arkins 2018-10-02 14:08:37 +02:00
parent e790af89d1
commit 924efa837f

View file

@ -41,7 +41,10 @@ function updateDependency(currentFileContent, upgrade) {
if (upgrade.depName.startsWith('gopkg.in/')) { if (upgrade.depName.startsWith('gopkg.in/')) {
const oldV = upgrade.depName.split('.').pop(); const oldV = upgrade.depName.split('.').pop();
newLine = newLine.replace(`.${oldV}`, `.v${upgrade.newMajor}`); newLine = newLine.replace(`.${oldV}`, `.v${upgrade.newMajor}`);
} else if (upgrade.newMajor > 1) { } else if (
upgrade.newMajor > 1 &&
!newLine.includes(`/v${upgrade.newMajor}`)
) {
if (upgrade.currentValue.match(/^v(0|1)\./)) { if (upgrade.currentValue.match(/^v(0|1)\./)) {
// Add version // Add version
newLine = newLine.replace(requireLine, `$1/v${upgrade.newMajor}$2$3`); newLine = newLine.replace(requireLine, `$1/v${upgrade.newMajor}$2$3`);