Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
14019fed
Unverified
Commit
14019fed
authored
Mar 4, 2023
by
Maxime Brunet
Committed by
GitHub
Mar 4, 2023
Browse files
Options
Downloads
Patches
Plain Diff
feat(gomod): enable gomodUpdateImportPaths for gopkg.in (#20743)
parent
7ff1a3b7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/manager/gomod/artifacts.spec.ts
+17
-2
17 additions, 2 deletions
lib/modules/manager/gomod/artifacts.spec.ts
lib/modules/manager/gomod/artifacts.ts
+2
-2
2 additions, 2 deletions
lib/modules/manager/gomod/artifacts.ts
with
19 additions
and
4 deletions
lib/modules/manager/gomod/artifacts.spec.ts
+
17
−
2
View file @
14019fed
...
@@ -1625,7 +1625,7 @@ describe('modules/manager/gomod/artifacts', () => {
...
@@ -1625,7 +1625,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
]);
});
});
it
(
'
skips
updat
ing
import paths for gopkg.in dependencies
'
,
async
()
=>
{
it
(
'
updat
es
import paths for gopkg.in dependencies
including v0 to v1
'
,
async
()
=>
{
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Current go.sum
'
);
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Current go.sum
'
);
fs
.
readLocalFile
.
mockResolvedValueOnce
(
null
);
// vendor modules filename
fs
.
readLocalFile
.
mockResolvedValueOnce
(
null
);
// vendor modules filename
const
execSnapshots
=
mockExecAll
();
const
execSnapshots
=
mockExecAll
();
...
@@ -1640,7 +1640,10 @@ describe('modules/manager/gomod/artifacts', () => {
...
@@ -1640,7 +1640,10 @@ describe('modules/manager/gomod/artifacts', () => {
expect
(
expect
(
await
gomod
.
updateArtifacts
({
await
gomod
.
updateArtifacts
({
packageFileName
:
'
go.mod
'
,
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
,
newPackageFileContent
:
gomod1
,
config
:
{
config
:
{
...
config
,
...
config
,
...
@@ -1657,6 +1660,18 @@ describe('modules/manager/gomod/artifacts', () => {
...
@@ -1657,6 +1660,18 @@ describe('modules/manager/gomod/artifacts', () => {
cmd
:
'
go get -d -t ./...
'
,
cmd
:
'
go get -d -t ./...
'
,
options
:
{
cwd
:
'
/tmp/github/some/repo
'
},
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
'
,
cmd
:
'
go mod tidy
'
,
options
:
{
cwd
:
'
/tmp/github/some/repo
'
},
options
:
{
cwd
:
'
/tmp/github/some/repo
'
},
...
...
This diff is collapsed.
Click to expand it.
lib/modules/manager/gomod/artifacts.ts
+
2
−
2
View file @
14019fed
...
@@ -134,9 +134,9 @@ function getUpdateImportPathCmds(
...
@@ -134,9 +134,9 @@ function getUpdateImportPathCmds(
depName
:
depName
!
,
depName
:
depName
!
,
newMajor
:
major
(
newVersion
!
),
newMajor
:
major
(
newVersion
!
),
}))
}))
// Skip path upates going from v0 to v1
// Skip path up
d
ates going from v0 to v1
.
filter
(
.
filter
(
({
depName
,
newMajor
})
=>
!
depName
.
startsWith
(
'
gopkg.in
'
)
&&
newMajor
>
1
({
depName
,
newMajor
})
=>
depName
.
startsWith
(
'
gopkg.in
'
)
||
newMajor
>
1
)
)
.
map
(
.
map
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment