mirror of
https://github.com/golang/go
synced 2024-10-04 15:09:59 +00:00
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: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
d7d3887e3e
commit
8827147932
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue