mirror of https://github.com/golang/go.git
cmd/internal/goobj: make the buildGoobj test helper work in module mode
Updates #30228 Change-Id: I8dd4a1f94dfd3be324a4f213941a20fa1b8b1215 Reviewed-on: https://go-review.googlesource.com/c/162832 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
4ad5537bfa
commit
34291f5f3e
|
|
@ -122,10 +122,14 @@ func buildGoobj() error {
|
|||
if testenv.HasCGO() {
|
||||
gopath := filepath.Join(buildDir, "gopath")
|
||||
err = copyDir(filepath.Join(gopath, "src", "mycgo"), filepath.Join("testdata", "mycgo"))
|
||||
if err == nil {
|
||||
err = ioutil.WriteFile(filepath.Join(gopath, "src", "mycgo", "go.mod"), []byte("module mycgo\n"), 0666)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cmd := exec.Command(gotool, "install", "-gcflags=all="+os.Getenv("GO_GCFLAGS"), "mycgo")
|
||||
cmd.Dir = filepath.Join(gopath, "src", "mycgo")
|
||||
cmd.Env = append(os.Environ(), "GOPATH="+gopath)
|
||||
out, err = cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue