Skip to content

Commit 8827147

Browse files
author
Bryan C. Mills
committed
cmd/nm: fix testGoLib helper to be module-agnostic
Updates #30228 Change-Id: I3c7864e6725312df5ec978cdc130ccfe8fc2e738 Reviewed-on: https://go-review.googlesource.com/c/162836 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent d7d3887 commit 8827147

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cmd/nm/nm_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,16 @@ func testGoLib(t *testing.T, iscgo bool) {
222222
if e := file.Close(); err == nil {
223223
err = e
224224
}
225+
if err == nil {
226+
err = ioutil.WriteFile(filepath.Join(libpath, "go.mod"), []byte("module mylib\n"), 0666)
227+
}
225228
if err != nil {
226229
t.Fatal(err)
227230
}
228231

229232
args := []string{"install", "mylib"}
230233
cmd := exec.Command(testenv.GoToolPath(t), args...)
234+
cmd.Dir = libpath
231235
cmd.Env = append(os.Environ(), "GOPATH="+gopath)
232236
out, err := cmd.CombinedOutput()
233237
if err != nil {

0 commit comments

Comments
 (0)