[build] internal/relui: include a package in fake golang.org/x/build module

0 views
Skip to first unread message

Dmitri Shuralyov (Gerrit)

unread,
Oct 14, 2025, 5:41:25 PM (yesterday) Oct 14
to Alan Donovan, goph...@pubsubhelper.golang.org, Roland Shoemaker, Dmitri Shuralyov, golang-co...@googlegroups.com
Attention needed from Alan Donovan

Dmitri Shuralyov has uploaded the change for review

Dmitri Shuralyov would like Alan Donovan to review this change.

Commit message

internal/relui: include a package in fake golang.org/x/build module

The "maintain go directive" automation includes a "go fix ./..." step.
Copying the motivation from go.dev/design/69095-x-repo-continuous-go:

> The first two commands in the sequence leave the module in a tidy
> state. The go fix ./... command will apply high-confidence automated
> changes, in case any begin to apply with the updated Go language
> version. For example, go fix began to remove the now-obsolete
> // +build lines once a module is upgraded to 1.18 or later. For many
> new language versions this will be a no-op, but it is expected that
> including a go fix ./... invocation will be a net positive. We can
> decide to stop including it in the generated CLs based on experience.

CL 700795 changed the behavior of "go fix ./..." in a module where the
"./..." pattern matches no packages from reporting a 0 exit code (like
'go build' does) to reporting a non-zero exit code (like 'go vet' does).

Add a package to the fake x/build module to make the TestRelease/major
test not sensitive to go fix's exit code when encountering no packages.
Such a test should exist, but it doesn't belong in an x/ repo far away
from the actual go fix command.

For golang/go#71859.
Change-Id: I321d734c3b0e61872f7486e7745c35e30632dbf5

Change diff

diff --git a/internal/relui/buildrelease_test.go b/internal/relui/buildrelease_test.go
index 66c9d4f..fba2faa 100644
--- a/internal/relui/buildrelease_test.go
+++ b/internal/relui/buildrelease_test.go
@@ -155,7 +155,8 @@
dlRepo := task.NewFakeRepo(t, "dl")
buildRepo := task.NewFakeRepo(t, "build")
buildRepo.Commit(map[string]string{
- "go.mod": "module golang.org/x/build\n",
+ "go.mod": "module golang.org/x/build\n",
+ "build.go": "package build\n",
})
toolsRepo := task.NewFakeRepo(t, "tools")
toolsRepo.Commit(map[string]string{

Change information

Files:
  • M internal/relui/buildrelease_test.go
Change size: XS
Delta: 1 file changed, 2 insertions(+), 1 deletion(-)
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
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: build
Gerrit-Branch: master
Gerrit-Change-Id: I321d734c3b0e61872f7486e7745c35e30632dbf5
Gerrit-Change-Number: 711920
Gerrit-PatchSet: 1
Gerrit-Owner: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-CC: Roland Shoemaker <rol...@golang.org>
Gerrit-Attention: Alan Donovan <adon...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Dmitri Shuralyov (Gerrit)

unread,
Oct 14, 2025, 5:42:25 PM (yesterday) Oct 14
to Dmitri Shuralyov, goph...@pubsubhelper.golang.org, Go LUCI, Alan Donovan, Roland Shoemaker, golang-co...@googlegroups.com
Attention needed from Alan Donovan

Dmitri Shuralyov voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
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: build
Gerrit-Branch: master
Gerrit-Change-Id: I321d734c3b0e61872f7486e7745c35e30632dbf5
Gerrit-Change-Number: 711920
Gerrit-PatchSet: 1
Gerrit-Owner: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-CC: Roland Shoemaker <rol...@golang.org>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Comment-Date: Tue, 14 Oct 2025 21:42:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Dmitri Shuralyov (Gerrit)

unread,
Oct 14, 2025, 5:50:55 PM (yesterday) Oct 14
to Dmitri Shuralyov, goph...@pubsubhelper.golang.org, Dmitri Shuralyov, Go LUCI, Alan Donovan, Roland Shoemaker, golang-co...@googlegroups.com
Attention needed from Alan Donovan

Dmitri Shuralyov added 1 comment

Commit Message
Line 21, Patchset 1 (Latest):CL 700795 changed the behavior of "go fix ./..." in a module where the
Dmitri Shuralyov . unresolved

@adon...@google.com I'm not yet sure whether the new 'go fix' behavior is better, since it requires automated callers either to add logic to handle "no packages to fix" errors, or to take extra measures to avoid running go fix if "./..." happens not to match any packages in the module being automatically processed. Both
can be hard to achieve in some environments (i.e., if generating a bash script that processes many modules).

In https://go.dev/issue/71859#issuecomment-2935949731, you wrote:

`go fix` command-line interface should resemble `go vet` as much as possible, [...] `vet` is responsible for emitting diagnostics and `fix` is responsible for quietly applying suggested fixes.
> [...]
> Our goal is that users should be able to run `go fix` on a large code base and merge the resulting CL with only cursory review, confident that the tools have not introduced bugs.

I understand and agree with the rationale to make go fix and go vet as similar as possible, but I wonder if making "go fix" exit with non-zero exit code goes against the goal of making it easy for users to run "go fix" on a large code base and merge the resulting CL with only cursory review. That is, it seems "no packages" being an error is maybe more friction for callers of go fix (e.g., potential scripts that process many repos) than it is for go vet callers (more likely to be humans rather than scripts). What do you think?

I mostly want to raise your attention on this, so feel free to ack this and leave follow up (if any) to issue #71859 rather than here. Thanks. (FWIW, issues #31271 and #52287 are also somewhat relevant to this topic.)

Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
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: build
    Gerrit-Branch: master
    Gerrit-Change-Id: I321d734c3b0e61872f7486e7745c35e30632dbf5
    Gerrit-Change-Number: 711920
    Gerrit-PatchSet: 1
    Gerrit-Owner: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
    Gerrit-CC: Roland Shoemaker <rol...@golang.org>
    Gerrit-Attention: Alan Donovan <adon...@google.com>
    Gerrit-Comment-Date: Tue, 14 Oct 2025 21:50:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Alan Donovan (Gerrit)

    unread,
    4:14 PM (8 hours ago) 4:14 PM
    to Dmitri Shuralyov, goph...@pubsubhelper.golang.org, Go LUCI, Dmitri Shuralyov, Roland Shoemaker, golang-co...@googlegroups.com
    Attention needed from Dmitri Shuralyov

    Alan Donovan added 1 comment

    Commit Message
    Line 21, Patchset 1 (Latest):CL 700795 changed the behavior of "go fix ./..." in a module where the
    Dmitri Shuralyov . unresolved

    @adon...@google.com I'm not yet sure whether the new 'go fix' behavior is better, since it requires automated callers either to add logic to handle "no packages to fix" errors, or to take extra measures to avoid running go fix if "./..." happens not to match any packages in the module being automatically processed. Both
    can be hard to achieve in some environments (i.e., if generating a bash script that processes many modules).

    In https://go.dev/issue/71859#issuecomment-2935949731, you wrote:

    `go fix` command-line interface should resemble `go vet` as much as possible, [...] `vet` is responsible for emitting diagnostics and `fix` is responsible for quietly applying suggested fixes.
    > [...]
    > Our goal is that users should be able to run `go fix` on a large code base and merge the resulting CL with only cursory review, confident that the tools have not introduced bugs.

    I understand and agree with the rationale to make go fix and go vet as similar as possible, but I wonder if making "go fix" exit with non-zero exit code goes against the goal of making it easy for users to run "go fix" on a large code base and merge the resulting CL with only cursory review. That is, it seems "no packages" being an error is maybe more friction for callers of go fix (e.g., potential scripts that process many repos) than it is for go vet callers (more likely to be humans rather than scripts). What do you think?

    I mostly want to raise your attention on this, so feel free to ack this and leave follow up (if any) to issue #71859 rather than here. Thanks. (FWIW, issues #31271 and #52287 are also somewhat relevant to this topic.)

    Alan Donovan

    I think of go vet and go fix as analogous of go build, but running analyzers instead of compilers, and I notice that go build exits zero when asked to build ./dir/... in a tree containing no Go source files. So that argues for making go vet and fix more like go build. But I wonder how in practice it would ever arise that a script runs go fix on a tree of no Go packages. That seems like a misconfiguration.

    Thanks for this CL.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dmitri Shuralyov
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: build
      Gerrit-Branch: master
      Gerrit-Change-Id: I321d734c3b0e61872f7486e7745c35e30632dbf5
      Gerrit-Change-Number: 711920
      Gerrit-PatchSet: 1
      Gerrit-Owner: Dmitri Shuralyov <dmit...@golang.org>
      Gerrit-Reviewer: Alan Donovan <adon...@google.com>
      Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
      Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
      Gerrit-CC: Roland Shoemaker <rol...@golang.org>
      Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
      Gerrit-Comment-Date: Wed, 15 Oct 2025 20:13:53 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Dmitri Shuralyov <dmit...@golang.org>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Alan Donovan (Gerrit)

      unread,
      4:14 PM (8 hours ago) 4:14 PM
      to Dmitri Shuralyov, goph...@pubsubhelper.golang.org, Go LUCI, Dmitri Shuralyov, Roland Shoemaker, golang-co...@googlegroups.com
      Attention needed from Dmitri Shuralyov

      Alan Donovan voted Code-Review+2

      Code-Review+2
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dmitri Shuralyov
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: build
      Gerrit-Branch: master
      Gerrit-Change-Id: I321d734c3b0e61872f7486e7745c35e30632dbf5
      Gerrit-Change-Number: 711920
      Gerrit-PatchSet: 1
      Gerrit-Owner: Dmitri Shuralyov <dmit...@golang.org>
      Gerrit-Reviewer: Alan Donovan <adon...@google.com>
      Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
      Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
      Gerrit-CC: Roland Shoemaker <rol...@golang.org>
      Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
      Gerrit-Comment-Date: Wed, 15 Oct 2025 20:14:01 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages