Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(go): Remove deprecated '-d' flag when doing 'go get' #32506

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ Also, approval rules overriding should not be [prevented in GitLab settings](htt

## goGetDirs

By default, Renovate will run `go get -d -t ./...` to update the `go.sum`.
By default, Renovate will run `go get -t ./...` to update the `go.sum`.
If you need to modify this path, for example in order to ignore directories, you can override the default `./...` value using this option:

```json
Expand Down
56 changes: 28 additions & 28 deletions lib/modules/manager/gomod/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('modules/manager/gomod/artifacts', () => {
).toBeNull();
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: {
cwd: '/tmp/github/some/repo',
env: {
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: {
cwd: '/tmp/github/some/repo',
env: {
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('modules/manager/gomod/artifacts', () => {

expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('modules/manager/gomod/artifacts', () => {

expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
]);
Expand Down Expand Up @@ -404,7 +404,7 @@ describe('modules/manager/gomod/artifacts', () => {

expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -482,7 +482,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.14.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
'"',
options: {
cwd: '/tmp/github/some/repo',
Expand Down Expand Up @@ -526,7 +526,7 @@ describe('modules/manager/gomod/artifacts', () => {
expect(execSnapshots).toMatchObject([
{ cmd: 'install-tool golang 1.14.0' },
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: {
cwd: '/tmp/github/some/repo',
env: {},
Expand Down Expand Up @@ -565,7 +565,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
]);
Expand Down Expand Up @@ -647,7 +647,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.14.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
'"',
options: {
cwd: '/tmp/github/some/repo',
Expand Down Expand Up @@ -1157,7 +1157,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.14.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
' && ' +
'go mod tidy' +
' && ' +
Expand Down Expand Up @@ -1221,7 +1221,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.14.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
' && ' +
'go mod tidy -compat=1.17' +
' && ' +
Expand Down Expand Up @@ -1285,7 +1285,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.14.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
' && ' +
'go mod tidy -compat=1.17 -e' +
' && ' +
Expand Down Expand Up @@ -1349,7 +1349,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.14.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
' && ' +
'go mod tidy -e' +
' && ' +
Expand Down Expand Up @@ -1419,7 +1419,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1475,7 +1475,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1532,7 +1532,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1577,7 +1577,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1626,7 +1626,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1671,7 +1671,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
]);
Expand Down Expand Up @@ -1707,7 +1707,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
]);
Expand Down Expand Up @@ -1750,7 +1750,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1809,7 +1809,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1863,7 +1863,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -1926,7 +1926,7 @@ describe('modules/manager/gomod/artifacts', () => {
expect(execSnapshots).toMatchObject([
{ cmd: 'install-tool golang 1.14.0' },
{
cmd: 'go get -d -t ./...',
cmd: 'go get -t ./...',
options: { cwd: '/tmp/github/some/repo' },
},
{
Expand Down Expand Up @@ -2006,7 +2006,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.17.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
' && ' +
'go install github.com/marwan-at-work/mod/cmd/mod@latest' +
' && ' +
Expand Down Expand Up @@ -2121,7 +2121,7 @@ describe('modules/manager/gomod/artifacts', () => {
' bash -l -c "' +
'install-tool golang 1.14.0' +
' && ' +
'go get -d -t ./...' +
'go get -t ./...' +
' && ' +
'go install github.com/marwan-at-work/mod/cmd/mod@latest' +
' && ' +
Expand Down Expand Up @@ -2159,7 +2159,7 @@ describe('modules/manager/gomod/artifacts', () => {
).toBeNull();
expect(execSnapshots).toMatchObject([
{
cmd: "go get -d -t . foo .bar/... '&&' cat",
cmd: "go get -t . foo .bar/... '&&' cat",
options: {
cwd: '/tmp/github/some/repo',
},
Expand Down Expand Up @@ -2199,7 +2199,7 @@ describe('modules/manager/gomod/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'go get -d -t .',
cmd: 'go get -t .',
options: {
cwd: '/tmp/github/some/repo',
},
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/gomod/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export async function updateArtifacts({
}
}

let args = `get -d -t ${goGetDirs ?? './...'}`;
let args = `get -t ${goGetDirs ?? './...'}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract go version from go and / or toolchain directive. drop -d only if it is >=1.18.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry was just about to comment: I made an update to update Go version after I realised it was currently older: #32514

logger.trace({ cmd, args }, 'go get command included');
execCommands.push(`${cmd} ${args}`);

Expand Down