From: Austin Clements Date: Thu, 24 Aug 2023 20:48:14 +0000 (-0400) Subject: cmd/go: remove unnecessary b.Print setting X-Git-Tag: go1.22rc1~648 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=262b8050daf588cd298527114cb377753f0a2c39;p=gostls13.git cmd/go: remove unnecessary b.Print setting 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 Reviewed-by: Bryan Mills --- diff --git a/src/cmd/go/internal/run/run.go b/src/cmd/go/internal/run/run.go index 4a3dcf0f1a..aabbf016b2 100644 --- a/src/cmd/go/internal/run/run.go +++ b/src/cmd/go/internal/run/run.go @@ -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") {