diff --git a/lib/modules/manager/gomod/artifacts.spec.ts b/lib/modules/manager/gomod/artifacts.spec.ts index 410a1d04b8967ebee51899cf26f40cae323694f3..869d5891cf3cd5241b77edd23b38810e51977610 100644 --- a/lib/modules/manager/gomod/artifacts.spec.ts +++ b/lib/modules/manager/gomod/artifacts.spec.ts @@ -1625,7 +1625,7 @@ describe('modules/manager/gomod/artifacts', () => { ]); }); - it('skips updating import paths for gopkg.in dependencies', async () => { + it('updates import paths for gopkg.in dependencies including v0 to v1', async () => { fs.readLocalFile.mockResolvedValueOnce('Current go.sum'); fs.readLocalFile.mockResolvedValueOnce(null); // vendor modules filename const execSnapshots = mockExecAll(); @@ -1640,7 +1640,10 @@ describe('modules/manager/gomod/artifacts', () => { expect( await gomod.updateArtifacts({ packageFileName: 'go.mod', - updatedDeps: [{ depName: 'gopkg.in/yaml.v2', newVersion: 'v28.0.0' }], + updatedDeps: [ + { depName: 'gopkg.in/yaml.v2', newVersion: 'v28.0.0' }, + { depName: 'gopkg.in/foo.v0', newVersion: 'v1.0.0' }, + ], newPackageFileContent: gomod1, config: { ...config, @@ -1657,6 +1660,18 @@ describe('modules/manager/gomod/artifacts', () => { cmd: 'go get -d -t ./...', options: { cwd: '/tmp/github/some/repo' }, }, + { + cmd: 'go install github.com/marwan-at-work/mod/cmd/mod@latest', + options: { cwd: '/tmp/github/some/repo' }, + }, + { + cmd: 'mod upgrade --mod-name=gopkg.in/yaml.v2 -t=28', + options: { cwd: '/tmp/github/some/repo' }, + }, + { + cmd: 'mod upgrade --mod-name=gopkg.in/foo.v0 -t=1', + options: { cwd: '/tmp/github/some/repo' }, + }, { cmd: 'go mod tidy', options: { cwd: '/tmp/github/some/repo' }, diff --git a/lib/modules/manager/gomod/artifacts.ts b/lib/modules/manager/gomod/artifacts.ts index 6378f7cd534764a747d728501868e6262c0d973d..570ffed67a64be0579d81406e2f7292cc2dddbd1 100644 --- a/lib/modules/manager/gomod/artifacts.ts +++ b/lib/modules/manager/gomod/artifacts.ts @@ -134,9 +134,9 @@ function getUpdateImportPathCmds( depName: depName!, newMajor: major(newVersion!), })) - // Skip path upates going from v0 to v1 + // Skip path updates going from v0 to v1 .filter( - ({ depName, newMajor }) => !depName.startsWith('gopkg.in') && newMajor > 1 + ({ depName, newMajor }) => depName.startsWith('gopkg.in') || newMajor > 1 ) .map(