t.Fatal(err)
}
- args := []string{"install", "mylib"}
- cmd := exec.Command(testenv.GoToolPath(t), args...)
+ cmd := exec.Command(testenv.GoToolPath(t), "build", "-buildmode=archive", "-o", "mylib.a", ".")
cmd.Dir = libpath
cmd.Env = append(os.Environ(), "GOPATH="+gopath)
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("building test lib failed: %s %s", err, out)
}
- pat := filepath.Join(gopath, "pkg", "*", "mylib.a")
- ms, err := filepath.Glob(pat)
- if err != nil {
- t.Fatal(err)
- }
- if len(ms) == 0 {
- t.Fatalf("cannot found paths for pattern %s", pat)
- }
- mylib := ms[0]
+ mylib := filepath.Join(libpath, "mylib.a")
out, err = exec.Command(testnmpath, mylib).CombinedOutput()
if err != nil {