1
0
mirror of https://github.com/golang/go synced 2024-11-16 22:14:45 -07:00

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 <adonovan@google.com>
This commit is contained in:
Robert Griesemer 2018-10-17 14:15:54 -07:00
parent bb3e211777
commit 4bea6c6594

View 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
}