Skip to content

Commit 34291f5

Browse files
author
Bryan C. Mills
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent 4ad5537 commit 34291f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cmd/internal/goobj/goobj_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ func buildGoobj() error {
122122
if testenv.HasCGO() {
123123
gopath := filepath.Join(buildDir, "gopath")
124124
err = copyDir(filepath.Join(gopath, "src", "mycgo"), filepath.Join("testdata", "mycgo"))
125+
if err == nil {
126+
err = ioutil.WriteFile(filepath.Join(gopath, "src", "mycgo", "go.mod"), []byte("module mycgo\n"), 0666)
127+
}
125128
if err != nil {
126129
return err
127130
}
128131
cmd := exec.Command(gotool, "install", "-gcflags=all="+os.Getenv("GO_GCFLAGS"), "mycgo")
132+
cmd.Dir = filepath.Join(gopath, "src", "mycgo")
129133
cmd.Env = append(os.Environ(), "GOPATH="+gopath)
130134
out, err = cmd.CombinedOutput()
131135
if err != nil {

0 commit comments

Comments
 (0)