]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/nm: fix testGoLib helper to be module-agnostic
authorBryan C. Mills <bcmills@google.com>
Tue, 19 Feb 2019 18:53:39 +0000 (13:53 -0500)
committerBryan C. Mills <bcmills@google.com>
Tue, 19 Feb 2019 20:53:59 +0000 (20:53 +0000)
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>
src/cmd/nm/nm_test.go

index 1b5bd21ad5dc0a8a1fe17e00f4d34ebc168e873a..8176ddd7f458706065e33e910dd05860695f602a 100644 (file)
@@ -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 {