From: Bryan C. Mills Date: Fri, 15 Feb 2019 23:04:32 +0000 (-0500) Subject: cmd/internal/goobj: make the buildGoobj test helper work in module mode X-Git-Tag: go1.13beta1~1452 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=34291f5f3e0a40eac110132b620b1444c2123d0e;p=gostls13.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 TryBot-Result: Gobot Gobot Reviewed-by: Jay Conrod --- diff --git a/src/cmd/internal/goobj/goobj_test.go b/src/cmd/internal/goobj/goobj_test.go index 3b41589bbf..840b45c908 100644 --- a/src/cmd/internal/goobj/goobj_test.go +++ b/src/cmd/internal/goobj/goobj_test.go @@ -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 {