From 4bea6c65947caf815ad4dde8bf50c43dcca539be Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 17 Oct 2018 14:15:54 -0700 Subject: [PATCH] go/internal/gccgoimporter: backport from x/tools to ensure identical code This change backports a minor modification of the x/tools version of this code back into the std library. It simply ensures that both versions of the code are the same and will simplify keeping them in sync down the road. While this is an API change, this is an internal package, so we're ok. Updates #27891. Change-Id: Ib153141382f727a2692ca80179ae09c4a383ba4f Reviewed-on: https://go-review.googlesource.com/c/142894 Reviewed-by: Alan Donovan --- src/go/internal/gccgoimporter/gccgoinstallation.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/go/internal/gccgoimporter/gccgoinstallation.go b/src/go/internal/gccgoimporter/gccgoinstallation.go index 622dfc8b69..8fc7ce3232 100644 --- a/src/go/internal/gccgoimporter/gccgoinstallation.go +++ b/src/go/internal/gccgoimporter/gccgoinstallation.go @@ -26,8 +26,10 @@ type GccgoInstallation struct { } // Ask the driver at the given path for information for this GccgoInstallation. -func (inst *GccgoInstallation) InitFromDriver(gccgoPath string) (err error) { - cmd := exec.Command(gccgoPath, "-###", "-S", "-x", "go", "-") +// The given arguments are passed directly to the call of the driver. +func (inst *GccgoInstallation) InitFromDriver(gccgoPath string, args ...string) (err error) { + argv := append([]string{"-###", "-S", "-x", "go", "-"}, args...) + cmd := exec.Command(gccgoPath, argv...) stderr, err := cmd.StderrPipe() if err != nil { return @@ -55,7 +57,8 @@ func (inst *GccgoInstallation) InitFromDriver(gccgoPath string) (err error) { } } - stdout, err := exec.Command(gccgoPath, "-dumpversion").Output() + argv = append([]string{"-dumpversion"}, args...) + stdout, err := exec.Command(gccgoPath, argv...).Output() if err != nil { return } -- 2.50.0