[go] os/exec: make the Cmd.Start example runnable in the playground

3 views
Skip to first unread message

shuang cui (Gerrit)

unread,
Jul 13, 2026, 10:16:53 AM (5 days ago) Jul 13
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

shuang cui has uploaded the change for review

Commit message

os/exec: make the Cmd.Start example runnable in the playground

The Cmd.Start example runs sleep for five seconds, which exceeds the
playground execution timeout when the example is run from pkg.go.dev.

Use echo instead. This keeps the example focused on the Start and Wait
workflow while allowing it to complete within the playground timeout.

Fixes #80236
Change-Id: I2fabac10fd0bb7b00af7473b957802b8f3afb644

Change diff

diff --git a/src/os/exec/example_test.go b/src/os/exec/example_test.go
index 150f5cf..725a391 100644
--- a/src/os/exec/example_test.go
+++ b/src/os/exec/example_test.go
@@ -63,7 +63,7 @@
}

func ExampleCmd_Start() {
- cmd := exec.Command("sleep", "5")
+ cmd := exec.Command("echo")
err := cmd.Start()
if err != nil {
log.Fatal(err)

Change information

Files:
  • M src/os/exec/example_test.go
Change size: XS
Delta: 1 file changed, 1 insertion(+), 1 deletion(-)
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: go
Gerrit-Branch: master
Gerrit-Change-Id: I2fabac10fd0bb7b00af7473b957802b8f3afb644
Gerrit-Change-Number: 800120
Gerrit-PatchSet: 1
Gerrit-Owner: shuang cui <imc...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

shuang cui (Gerrit)

unread,
Jul 13, 2026, 10:29:06 AM (5 days ago) Jul 13
to goph...@pubsubhelper.golang.org, Brad Fitzpatrick, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick and Ian Lance Taylor

shuang cui voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • Ian Lance Taylor
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: I2fabac10fd0bb7b00af7473b957802b8f3afb644
Gerrit-Change-Number: 800120
Gerrit-PatchSet: 1
Gerrit-Owner: shuang cui <imc...@gmail.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: shuang cui <imc...@gmail.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Comment-Date: Mon, 13 Jul 2026 14:28:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Jul 13, 2026, 1:28:02 PM (4 days ago) Jul 13
to shuang cui, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Brad Fitzpatrick, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick and shuang cui

Ian Lance Taylor added 1 comment

File src/os/exec/example_test.go
Line 66, Patchset 1 (Latest): cmd := exec.Command("echo")
Ian Lance Taylor . unresolved

Why don't we actually echo a value? "echo", "hello", "world"

Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • shuang cui
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: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I2fabac10fd0bb7b00af7473b957802b8f3afb644
    Gerrit-Change-Number: 800120
    Gerrit-PatchSet: 1
    Gerrit-Owner: shuang cui <imc...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: shuang cui <imc...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: shuang cui <imc...@gmail.com>
    Gerrit-Comment-Date: Mon, 13 Jul 2026 17:27:57 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    shuang cui (Gerrit)

    unread,
    Jul 14, 2026, 4:50:41 AM (4 days ago) Jul 14
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick and shuang cui

    shuang cui uploaded new patchset

    shuang cui uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • shuang cui
    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: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I2fabac10fd0bb7b00af7473b957802b8f3afb644
      Gerrit-Change-Number: 800120
      Gerrit-PatchSet: 2
      unsatisfied_requirement
      open
      diffy

      shuang cui (Gerrit)

      unread,
      Jul 14, 2026, 5:05:08 AM (4 days ago) Jul 14
      to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Brad Fitzpatrick, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Brad Fitzpatrick and Ian Lance Taylor

      shuang cui voted and added 1 comment

      Votes added by shuang cui

      Commit-Queue+1

      1 comment

      File src/os/exec/example_test.go
      Line 66, Patchset 1: cmd := exec.Command("echo")
      Ian Lance Taylor . resolved

      Why don't we actually echo a value? "echo", "hello", "world"

      shuang cui

      Good point. Using echo with an actual value makes the example command more natural.

      Thanks for the suggestion.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Brad Fitzpatrick
      • Ian Lance Taylor
      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: I2fabac10fd0bb7b00af7473b957802b8f3afb644
        Gerrit-Change-Number: 800120
        Gerrit-PatchSet: 2
        Gerrit-Owner: shuang cui <imc...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: shuang cui <imc...@gmail.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Comment-Date: Tue, 14 Jul 2026 09:05:00 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Ian Lance Taylor <ia...@golang.org>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Sean Liao (Gerrit)

        unread,
        6:46 PM (4 hours ago) 6:46 PM
        to shuang cui, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Brad Fitzpatrick, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Brad Fitzpatrick, Ian Lance Taylor and shuang cui

        Sean Liao voted Code-Review+2

        Code-Review+2
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Brad Fitzpatrick
        • Ian Lance Taylor
        • shuang cui
        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: I2fabac10fd0bb7b00af7473b957802b8f3afb644
        Gerrit-Change-Number: 800120
        Gerrit-PatchSet: 2
        Gerrit-Owner: shuang cui <imc...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Sean Liao <se...@liao.dev>
        Gerrit-Reviewer: shuang cui <imc...@gmail.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: shuang cui <imc...@gmail.com>
        Gerrit-Comment-Date: Fri, 17 Jul 2026 22:46:21 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages