[tools] go/packages: explicitly disable collecting vcs information when not needed

6 views
Skip to first unread message

Pierre Gimalac (Gerrit)

unread,
Feb 3, 2026, 8:55:07 AMFeb 3
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Pierre Gimalac has uploaded the change for review

Commit message

go/packages: explicitly disable collecting vcs information when not needed

By default VCS information is collected only when needed, which is not the case here, so this change shouldn't be necessary.
However this is currently being collected for test packages, and it seems that it has already happened before as well,
so since here we know it's not needed we can just force disable it to ensure it is fixed and stays fixed.

This fixes (some) issues with gopls hanging for a long time while initializing.
In my case it reduces the go list command duration from 2min30 to around 10 seconds.

Fixes golang/go#77419.
Fixes golang/go#51999.
Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9

Change diff

diff --git a/go/packages/golist.go b/go/packages/golist.go
index 680a70c..a11b431 100644
--- a/go/packages/golist.go
+++ b/go/packages/golist.go
@@ -842,6 +842,11 @@
fullargs = append(fullargs, "-pgo=off")
}

+ if !usesExportData(cfg) {
+ // VCS information is not needed when -export=false and not printing Stale or StaleReason fields
+ fullargs = append(fullargs, "-buildvcs=false")
+ }
+
fullargs = append(fullargs, cfg.BuildFlags...)
fullargs = append(fullargs, "--")
fullargs = append(fullargs, words...)

Change information

Files:
  • M go/packages/golist.go
Change size: XS
Delta: 1 file changed, 5 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
Gerrit-Change-Number: 741480
Gerrit-PatchSet: 1
Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
Feb 3, 2026, 9:57:52 AMFeb 3
to Pierre Gimalac, goph...@pubsubhelper.golang.org, Peter Weinberger, Michael Matloob, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Pierre Gimalac

Alan Donovan added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Alan Donovan . resolved

Thanks for investigating this. I noticed this was an issue last week, and Peter (cc'd) has started looking into certain go list inefficiencies.

It would be nice if these tricky cross-cutting interactions had tests. I think it should be possible to set up a test by running 'git init' in a temp directory, to establish for go list that this is a git repo, and then putting a fake `git` bash wrapper script on the PATH ahead of the real git; the fake git can log its interactions so that the test can assert whether git was or was not called as expected.

Open in Gerrit

Related details

Attention is currently required from:
  • Pierre Gimalac
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
Gerrit-Change-Number: 741480
Gerrit-PatchSet: 1
Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-CC: Michael Matloob <mat...@golang.org>
Gerrit-CC: Peter Weinberger <p...@google.com>
Gerrit-Attention: Pierre Gimalac <pierre....@datadoghq.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 14:57:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
Feb 3, 2026, 9:58:54 AMFeb 3
to Pierre Gimalac, goph...@pubsubhelper.golang.org, Peter Weinberger, Michael Matloob, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Pierre Gimalac

Alan Donovan added 1 comment

Patchset-level comments
Alan Donovan . resolved

Thanks for investigating this. I noticed this was an issue last week, and Peter (cc'd) has started looking into certain go list inefficiencies.

It would be nice if these tricky cross-cutting interactions had tests. I think it should be possible to set up a test by running 'git init' in a temp directory, to establish for go list that this is a git repo, and then putting a fake `git` bash wrapper script on the PATH ahead of the real git; the fake git can log its interactions so that the test can assert whether git was or was not called as expected.

Alan Donovan

Michael (cc'd) is the expert here and may have better ideas or know of precedents for such tests.

Open in Gerrit

Related details

Attention is currently required from:
  • Pierre Gimalac
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
Gerrit-Change-Number: 741480
Gerrit-PatchSet: 1
Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-CC: Michael Matloob <mat...@golang.org>
Gerrit-CC: Peter Weinberger <p...@google.com>
Gerrit-Attention: Pierre Gimalac <pierre....@datadoghq.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 14:58:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Alan Donovan <adon...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Pierre Gimalac (Gerrit)

unread,
Feb 5, 2026, 6:44:39 PMFeb 5
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Pierre Gimalac

Pierre Gimalac uploaded new patchset

Pierre Gimalac uploaded patch set #2 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Pierre Gimalac
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
Gerrit-Change-Number: 741480
Gerrit-PatchSet: 2
unsatisfied_requirement
satisfied_requirement
open
diffy

Pierre Gimalac (Gerrit)

unread,
Feb 20, 2026, 8:42:28 AM (5 days ago) Feb 20
to goph...@pubsubhelper.golang.org, Michael Matloob, Peter Weinberger, Alan Donovan, Michael Matloob, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Michael Matloob

Pierre Gimalac added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Pierre Gimalac . unresolved

@p...@google.com @adon...@google.com @mat...@google.com is there anything I need to do for this ?
The fix on go itself was merged (https://go-review.googlesource.com/c/go/+/740901), but I still think this one is valuable as well, since we know VCS info is not needed here.

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Matloob
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
    Gerrit-Change-Number: 741480
    Gerrit-PatchSet: 2
    Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Michael Matloob <mat...@google.com>
    Gerrit-CC: Peter Weinberger <p...@google.com>
    Gerrit-Attention: Michael Matloob <mat...@google.com>
    Gerrit-Comment-Date: Fri, 20 Feb 2026 13:42:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Michael Matloob (Gerrit)

    unread,
    Feb 24, 2026, 4:30:31 PM (13 hours ago) Feb 24
    to Pierre Gimalac, goph...@pubsubhelper.golang.org, Peter Weinberger, Michael Matloob, Alan Donovan, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Michael Matloob and Peter Weinberger

    Michael Matloob voted and added 1 comment

    Votes added by Michael Matloob

    Code-Review+2

    1 comment

    Patchset-level comments
    Michael Matloob . resolved

    This change looks fine to me, but I agree with Alan that it would be nice to have tests.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Matloob
    • Peter Weinberger
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
    Gerrit-Change-Number: 741480
    Gerrit-PatchSet: 2
    Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-Reviewer: Peter Weinberger <p...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Peter Weinberger <p...@google.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 21:30:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Matloob (Gerrit)

    unread,
    Feb 24, 2026, 4:31:20 PM (12 hours ago) Feb 24
    to Pierre Gimalac, goph...@pubsubhelper.golang.org, Peter Weinberger, Michael Matloob, Alan Donovan, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Michael Matloob, Peter Weinberger and Pierre Gimalac

    Michael Matloob added 1 comment

    Patchset-level comments
    Pierre Gimalac . unresolved

    @p...@google.com @adon...@google.com @mat...@google.com is there anything I need to do for this ?
    The fix on go itself was merged (https://go-review.googlesource.com/c/go/+/740901), but I still think this one is valuable as well, since we know VCS info is not needed here.

    Michael Matloob

    I think the only thing is trying to see if we can add tests?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Matloob
    • Peter Weinberger
    • Pierre Gimalac
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
    Gerrit-Change-Number: 741480
    Gerrit-PatchSet: 2
    Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-Reviewer: Peter Weinberger <p...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Pierre Gimalac <pierre....@datadoghq.com>
    Gerrit-Attention: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Peter Weinberger <p...@google.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 21:31:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Pierre Gimalac <pierre....@datadoghq.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Pierre Gimalac (Gerrit)

    unread,
    Feb 24, 2026, 6:32:42 PM (10 hours ago) Feb 24
    to goph...@pubsubhelper.golang.org, Michael Matloob, Peter Weinberger, Michael Matloob, Alan Donovan, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Michael Matloob, Michael Matloob and Peter Weinberger

    Pierre Gimalac added 1 comment

    Patchset-level comments
    Pierre Gimalac . unresolved

    @p...@google.com @adon...@google.com @mat...@google.com is there anything I need to do for this ?
    The fix on go itself was merged (https://go-review.googlesource.com/c/go/+/740901), but I still think this one is valuable as well, since we know VCS info is not needed here.

    Michael Matloob

    I think the only thing is trying to see if we can add tests?

    Pierre Gimalac

    Are you thinking unit tests or actual e2e tests ensuring gopls doesn't exec git under the hood ?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Matloob
    • Michael Matloob
    • Peter Weinberger
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
    Gerrit-Change-Number: 741480
    Gerrit-PatchSet: 2
    Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-Reviewer: Peter Weinberger <p...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Attention: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Peter Weinberger <p...@google.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 23:32:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Michael Matloob <mat...@golang.org>
    Comment-In-Reply-To: Pierre Gimalac <pierre....@datadoghq.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Alan Donovan (Gerrit)

    unread,
    Feb 24, 2026, 8:19:52 PM (9 hours ago) Feb 24
    to Pierre Gimalac, goph...@pubsubhelper.golang.org, Michael Matloob, Peter Weinberger, Michael Matloob, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Michael Matloob, Michael Matloob, Peter Weinberger and Pierre Gimalac

    Alan Donovan added 1 comment

    Patchset-level comments
    Pierre Gimalac . unresolved

    @p...@google.com @adon...@google.com @mat...@google.com is there anything I need to do for this ?
    The fix on go itself was merged (https://go-review.googlesource.com/c/go/+/740901), but I still think this one is valuable as well, since we know VCS info is not needed here.

    Michael Matloob

    I think the only thing is trying to see if we can add tests?

    Pierre Gimalac

    Are you thinking unit tests or actual e2e tests ensuring gopls doesn't exec git under the hood ?

    Alan Donovan

    A test that calls packages.Load having temporarily added a directory containing a fake git command to the PATH should do the trick. The fake command just needs to do something that causes the test to fail.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Matloob
    • Michael Matloob
    • Peter Weinberger
    • Pierre Gimalac
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I5567ee01a3bcbed4c41497f7eaf8dc346e96efd9
    Gerrit-Change-Number: 741480
    Gerrit-PatchSet: 2
    Gerrit-Owner: Pierre Gimalac <pierre....@datadoghq.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-Reviewer: Peter Weinberger <p...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Attention: Pierre Gimalac <pierre....@datadoghq.com>
    Gerrit-Attention: Michael Matloob <mat...@google.com>
    Gerrit-Attention: Peter Weinberger <p...@google.com>
    Gerrit-Comment-Date: Wed, 25 Feb 2026 01:19:47 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages