]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: remove unnecessary b.Print setting
authorAustin Clements <austin@google.com>
Thu, 24 Aug 2023 20:48:14 +0000 (16:48 -0400)
committerAustin Clements <austin@google.com>
Mon, 9 Oct 2023 20:51:16 +0000 (20:51 +0000)
The Builder returned by work.NewBuilder is already setup to print to
os.Stderr, so it's not necessary for runRun to set b.Print to a
different function that does exactly the same thing.

This b.Print assignment was introduced in CL 5591045. At the time, the
builder type defaulted to printing to os.Stdout, so this was necessary
to make "go run" print build errors to stderr.

Change-Id: I0c07984616c5efc37ba681f4cf69e83542566bab
Reviewed-on: https://go-review.googlesource.com/c/go/+/522796
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/go/internal/run/run.go

index 4a3dcf0f1a8ee2b8b0266da2b5f54f2bf9d1a05c..aabbf016b274eee8f1637af1d74b96d4fa69627f 100644 (file)
@@ -7,9 +7,7 @@ package run
 
 import (
        "context"
-       "fmt"
        "go/build"
-       "os"
        "path"
        "path/filepath"
        "strings"
@@ -75,10 +73,6 @@ func init() {
        CmdRun.Flag.Var((*base.StringsFlag)(&work.ExecCmd), "exec", "")
 }
 
-func printStderr(args ...any) (int, error) {
-       return fmt.Fprint(os.Stderr, args...)
-}
-
 func runRun(ctx context.Context, cmd *base.Command, args []string) {
        if shouldUseOutsideModuleMode(args) {
                // Set global module flags for 'go run cmd@version'.
@@ -100,7 +94,6 @@ func runRun(ctx context.Context, cmd *base.Command, args []string) {
                        base.Fatal(err)
                }
        }()
-       b.Print = printStderr
 
        i := 0
        for i < len(args) && strings.HasSuffix(args[i], ".go") {