Commit 88271479 authored by Bryan C. Mills's avatar Bryan C. Mills

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 <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent d7d3887e
...@@ -222,12 +222,16 @@ func testGoLib(t *testing.T, iscgo bool) { ...@@ -222,12 +222,16 @@ func testGoLib(t *testing.T, iscgo bool) {
if e := file.Close(); err == nil { if e := file.Close(); err == nil {
err = e err = e
} }
if err == nil {
err = ioutil.WriteFile(filepath.Join(libpath, "go.mod"), []byte("module mylib\n"), 0666)
}
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
args := []string{"install", "mylib"} args := []string{"install", "mylib"}
cmd := exec.Command(testenv.GoToolPath(t), args...) cmd := exec.Command(testenv.GoToolPath(t), args...)
cmd.Dir = libpath
cmd.Env = append(os.Environ(), "GOPATH="+gopath) cmd.Env = append(os.Environ(), "GOPATH="+gopath)
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment