[go] cmd/go: print flags in -h / -help

4 views
Skip to first unread message

Sean Liao (Gerrit)

unread,
Jul 18, 2026, 2:55:48 PM (3 days ago) Jul 18
to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Sean Liao

Message from Sean Liao

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • Sean Liao
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: go
Gerrit-Branch: master
Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
Gerrit-Change-Number: 802680
Gerrit-PatchSet: 3
Gerrit-Owner: Sean Liao <se...@liao.dev>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
Gerrit-Attention: Sean Liao <se...@liao.dev>
Gerrit-Comment-Date: Sat, 18 Jul 2026 18:55:39 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Sean Liao (Gerrit)

unread,
Jul 18, 2026, 2:56:04 PM (3 days ago) Jul 18
to goph...@pubsubhelper.golang.org, Michael Matloob, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Michael Matloob

Sean Liao voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Michael Matloob
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: go
Gerrit-Branch: master
Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
Gerrit-Change-Number: 802680
Gerrit-PatchSet: 3
Gerrit-Owner: Sean Liao <se...@liao.dev>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Sat, 18 Jul 2026 18:55:56 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Sean Liao (Gerrit)

unread,
Jul 18, 2026, 5:16:14 PM (3 days ago) Jul 18
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Michael Matloob and Sean Liao

Sean Liao uploaded new patchset

Sean Liao uploaded patch set #4 to this change.
Following approvals got outdated and were removed:
Open in Gerrit

Related details

Attention is currently required from:
  • Michael Matloob
  • Sean Liao
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: go
Gerrit-Branch: master
Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
Gerrit-Change-Number: 802680
Gerrit-PatchSet: 4
Gerrit-Owner: Sean Liao <se...@liao.dev>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Attention: Sean Liao <se...@liao.dev>
unsatisfied_requirement
satisfied_requirement
open
diffy

Michael Matloob (Gerrit)

unread,
Jul 20, 2026, 11:04:53 AM (yesterday) Jul 20
to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Sean Liao

Michael Matloob voted and added 8 comments

Votes added by Michael Matloob

Code-Review+2

8 comments

File src/cmd/go/chdir_test.go
Line 46, Patchset 4 (Latest): } else if f.Usage != "change to `dir` before running the command" {
Michael Matloob . unresolved

do we use backticks in other places? should this be 'dir'?

File src/cmd/go/internal/bug/bug.go
Line 69, Patchset 4 (Latest):
Michael Matloob . unresolved

stray?

File src/cmd/go/internal/list/list.go
Line 34, Patchset 4 (Latest): "golang.org/x/sync/semaphore"
Michael Matloob . unresolved

did gofmt move this?

File src/cmd/go/internal/modcmd/download.go
Line 81, Patchset 4 (Latest): downloadJSON = cmdDownload.Flag.Bool("json", false, "print a sequence of JSON objects")
Michael Matloob . unresolved

maybe add "describing each downloaded module (or failure)"

File src/cmd/go/internal/modcmd/tidy.go
Line 74, Patchset 4 (Latest): cmdTidy.Flag.BoolVar(&tidyDiff, "diff", false, "display the differences with the proposed tidy rules")
Michael Matloob . unresolved

"proposed tidy rules" sounds a bit unclear to me.

maybe something like "display the diff of the edits that would be made" ?

Line 76, Patchset 4 (Latest): cmdTidy.Flag.Var(&tidyCompat, "compat", "set the Go `version` for which the tidied go.mod and go.sum files should be compatible")
Michael Matloob . resolved

Off topic, but I think we should maybe change this to have no effect for 1.21+ modules...

File src/cmd/go/internal/work/build.go
Line 356, Patchset 4 (Latest): cmd.Flag.Var((*base.StringsFlag)(&cfg.BuildToolexec), "toolexec", "a `program` to use to invoke toolchain programs like vet and asm")
Michael Matloob . unresolved

maybe we should point to go help build for more information about toolexec?

Line 361, Patchset 4 (Latest): cmd.Flag.StringVar(&cfg.DebugActiongraph, "debug-actiongraph", "", "write action graph to `file`")
Michael Matloob . unresolved

We should skip printing these flags' docs, and maybe leave the help text blank.

Open in Gerrit

Related details

Attention is currently required from:
  • Sean Liao
Submit Requirements:
  • requirement 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: go
Gerrit-Branch: master
Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
Gerrit-Change-Number: 802680
Gerrit-PatchSet: 4
Gerrit-Owner: Sean Liao <se...@liao.dev>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
Gerrit-Attention: Sean Liao <se...@liao.dev>
Gerrit-Comment-Date: Mon, 20 Jul 2026 15:04:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Michael Matloob (Gerrit)

unread,
Jul 20, 2026, 11:08:37 AM (yesterday) Jul 20
to goph...@pubsubhelper.golang.org, Michael Matloob, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Sean Liao

Michael Matloob voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Sean Liao
Submit Requirements:
  • requirement 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: go
Gerrit-Branch: master
Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
Gerrit-Change-Number: 802680
Gerrit-PatchSet: 4
Gerrit-Owner: Sean Liao <se...@liao.dev>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@google.com>
Gerrit-Comment-Date: Mon, 20 Jul 2026 15:08:32 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Sean Liao (Gerrit)

unread,
Jul 20, 2026, 11:33:33 AM (yesterday) Jul 20
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Sean Liao

Sean Liao uploaded new patchset

Sean Liao uploaded patch set #5 to this change.
Following approvals got outdated and were removed:

Related details

Attention is currently required from:
  • Sean Liao
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: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
    Gerrit-Change-Number: 802680
    Gerrit-PatchSet: 5
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sean Liao (Gerrit)

    unread,
    Jul 20, 2026, 11:34:41 AM (yesterday) Jul 20
    to goph...@pubsubhelper.golang.org, Michael Matloob, Michael Matloob, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
    Attention needed from Michael Matloob

    Sean Liao added 7 comments

    File src/cmd/go/chdir_test.go
    Line 46, Patchset 4: } else if f.Usage != "change to `dir` before running the command" {
    Michael Matloob . resolved

    do we use backticks in other places? should this be 'dir'?

    Sean Liao

    This test is a bit weird, but it identifies where the -C is from by checking the usage string, in this case
    src/cmd/go/internal/base/flag.go Line 65.

    The backticks in the usage message are for the flag package https://pkg.go.dev/flag#PrintDefaults
    where it uses the back quoted value in the short usage, otherwise all of them default to the literal string `value`, like: `-someflag value`

    File src/cmd/go/internal/bug/bug.go
    Line 69, Patchset 4:
    Michael Matloob . resolved

    stray?

    Sean Liao

    I'll undo this, I accidentally had gopls.gofumpt setting on for some edits.

    File src/cmd/go/internal/list/list.go
    Line 34, Patchset 4: "golang.org/x/sync/semaphore"
    Michael Matloob . resolved

    did gofmt move this?

    Sean Liao

    gopls, when locals is set (if not it just lumps cmd/ with the standard library).
    I believe this ordering is consistent with the other files.

    File src/cmd/go/internal/modcmd/download.go
    Line 81, Patchset 4: downloadJSON = cmdDownload.Flag.Bool("json", false, "print a sequence of JSON objects")
    Michael Matloob . resolved

    maybe add "describing each downloaded module (or failure)"

    Sean Liao

    Done

    File src/cmd/go/internal/modcmd/tidy.go
    Line 74, Patchset 4: cmdTidy.Flag.BoolVar(&tidyDiff, "diff", false, "display the differences with the proposed tidy rules")
    Michael Matloob . resolved

    "proposed tidy rules" sounds a bit unclear to me.

    maybe something like "display the diff of the edits that would be made" ?

    Sean Liao

    Done

    File src/cmd/go/internal/work/build.go
    Line 356, Patchset 4: cmd.Flag.Var((*base.StringsFlag)(&cfg.BuildToolexec), "toolexec", "a `program` to use to invoke toolchain programs like vet and asm")
    Michael Matloob . resolved

    maybe we should point to go help build for more information about toolexec?

    Sean Liao

    Done

    Line 361, Patchset 4: cmd.Flag.StringVar(&cfg.DebugActiongraph, "debug-actiongraph", "", "write action graph to `file`")
    Michael Matloob . unresolved

    We should skip printing these flags' docs, and maybe leave the help text blank.

    Sean Liao

    I don't think there's actually a way to hide flags in a flag.FlagSet though
    unless we preparse the args and remove them?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Matloob
    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: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
    Gerrit-Change-Number: 802680
    Gerrit-PatchSet: 5
    Gerrit-Owner: Sean Liao <se...@liao.dev>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-Reviewer: Michael Matloob <mat...@google.com>
    Gerrit-Reviewer: Sean Liao <se...@liao.dev>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Comment-Date: Mon, 20 Jul 2026 15:34:33 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Michael Matloob <mat...@golang.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Matloob (Gerrit)

    unread,
    Jul 20, 2026, 12:21:50 PM (yesterday) Jul 20
    to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Michael Matloob, golang-co...@googlegroups.com
    Attention needed from Sean Liao

    Michael Matloob voted and added 1 comment

    Votes added by Michael Matloob

    Code-Review+2

    1 comment

    File src/cmd/go/internal/work/build.go
    Line 361, Patchset 4: cmd.Flag.StringVar(&cfg.DebugActiongraph, "debug-actiongraph", "", "write action graph to `file`")
    Michael Matloob . resolved

    We should skip printing these flags' docs, and maybe leave the help text blank.

    Sean Liao

    I don't think there's actually a way to hide flags in a flag.FlagSet though
    unless we preparse the args and remove them?

    Michael Matloob

    ok i think leaving the documentation empty is good for now.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Sean Liao
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement 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: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
    Gerrit-Change-Number: 802680
    Gerrit-PatchSet: 5
    Gerrit-Owner: Sean Liao <se...@liao.dev>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-Reviewer: Michael Matloob <mat...@google.com>
    Gerrit-Reviewer: Sean Liao <se...@liao.dev>
    Gerrit-Attention: Sean Liao <se...@liao.dev>
    Gerrit-Comment-Date: Mon, 20 Jul 2026 16:21:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Michael Matloob <mat...@golang.org>
    Comment-In-Reply-To: Sean Liao <se...@liao.dev>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Carlos Amedee (Gerrit)

    unread,
    5:39 PM (5 hours ago) 5:39 PM
    to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Michael Matloob, Michael Matloob, golang-co...@googlegroups.com
    Attention needed from Sean Liao

    Carlos Amedee voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Sean Liao
    Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement 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: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
      Gerrit-Change-Number: 802680
      Gerrit-PatchSet: 5
      Gerrit-Owner: Sean Liao <se...@liao.dev>
      Gerrit-Reviewer: Carlos Amedee <car...@golang.org>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-Reviewer: Michael Matloob <mat...@google.com>
      Gerrit-Reviewer: Sean Liao <se...@liao.dev>
      Gerrit-Attention: Sean Liao <se...@liao.dev>
      Gerrit-Comment-Date: Tue, 21 Jul 2026 21:39:11 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Sean Liao (Gerrit)

      unread,
      5:47 PM (5 hours ago) 5:47 PM
      to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Carlos Amedee, golang...@luci-project-accounts.iam.gserviceaccount.com, Michael Matloob, Michael Matloob, golang-co...@googlegroups.com

      Sean Liao submitted the change

      Change information

      Commit message:
      cmd/go: print flags in -h / -help

      For #63659
      Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
      Reviewed-by: Carlos Amedee <car...@golang.org>
      Reviewed-by: Michael Matloob <mat...@golang.org>
      Reviewed-by: Michael Matloob <mat...@google.com>
      Files:
      • M src/cmd/go/chdir_test.go
      • M src/cmd/go/internal/base/base.go
      • M src/cmd/go/internal/base/flag.go
      • M src/cmd/go/internal/bug/bug.go
      • M src/cmd/go/internal/clean/clean.go
      • M src/cmd/go/internal/doc/doc.go
      • M src/cmd/go/internal/envcmd/env.go
      • M src/cmd/go/internal/generate/generate.go
      • M src/cmd/go/internal/list/list.go
      • M src/cmd/go/internal/modcmd/download.go
      • M src/cmd/go/internal/modcmd/edit.go
      • M src/cmd/go/internal/modcmd/graph.go
      • M src/cmd/go/internal/modcmd/tidy.go
      • M src/cmd/go/internal/modcmd/vendor.go
      • M src/cmd/go/internal/modcmd/why.go
      • M src/cmd/go/internal/modget/get.go
      • M src/cmd/go/internal/run/run.go
      • M src/cmd/go/internal/test/testflag.go
      • M src/cmd/go/internal/version/version.go
      • M src/cmd/go/internal/vet/vetflag.go
      • M src/cmd/go/internal/work/build.go
      • M src/cmd/go/internal/workcmd/edit.go
      • M src/cmd/go/internal/workcmd/use.go
      • M src/cmd/go/internal/workcmd/vendor.go
      • M src/cmd/go/testdata/script/build_buildvcs_auto.txt
      • M src/cmd/go/testdata/script/mod_graph_version.txt
      Change size: L
      Delta: 26 files changed, 208 insertions(+), 188 deletions(-)
      Branch: refs/heads/master
      Submit Requirements:
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I0bb318f6bae169b04d39af2d295be0296a6a6964
      Gerrit-Change-Number: 802680
      Gerrit-PatchSet: 6
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages