From 8827147932314ab623cc65e071c5b48b2d76e37b Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 19 Feb 2019 13:53:39 -0500 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/cmd/nm/nm_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/nm/nm_test.go b/src/cmd/nm/nm_test.go index 1b5bd21ad5dc0..8176ddd7f4587 100644 --- a/src/cmd/nm/nm_test.go +++ b/src/cmd/nm/nm_test.go @@ -222,12 +222,16 @@ func testGoLib(t *testing.T, iscgo bool) { if e := file.Close(); err == nil { err = e } + if err == nil { + err = ioutil.WriteFile(filepath.Join(libpath, "go.mod"), []byte("module mylib\n"), 0666) + } if err != nil { t.Fatal(err) } args := []string{"install", "mylib"} cmd := exec.Command(testenv.GoToolPath(t), args...) + cmd.Dir = libpath cmd.Env = append(os.Environ(), "GOPATH="+gopath) out, err := cmd.CombinedOutput() if err != nil {