Skip to content

Commit

Permalink
cmd/nm: fix testGoLib helper to be module-agnostic
Browse files Browse the repository at this point in the history
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: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
Bryan C. Mills committed Feb 19, 2019
1 parent d7d3887 commit 8827147
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cmd/nm/nm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8827147

Please sign in to comment.