]> Cypherpunks repositories - gostls13.git/commitdiff
go/internal/gccgoimporter: backport from x/tools to ensure identical code
authorRobert Griesemer <gri@golang.org>
Wed, 17 Oct 2018 21:15:54 +0000 (14:15 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 17 Oct 2018 21:28:04 +0000 (21:28 +0000)
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 <adonovan@google.com>
src/go/internal/gccgoimporter/gccgoinstallation.go

index 622dfc8b69642d30ffc73af80223ef19715a7860..8fc7ce3232190c93bb74f445bf55be1929e4c786 100644 (file)
@@ -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
        }