mirror of https://github.com/golang/go.git
misc/cgo/errors: fix tests in module mode
Updates #30228 Change-Id: I84bc705591bdb3da0106404b24353251939355b8 Reviewed-on: https://go-review.googlesource.com/c/163209 Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
b35dacaac5
commit
8ea27e117f
|
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func path(file string) string {
|
||||
return filepath.Join("src", file)
|
||||
return filepath.Join("testdata", file)
|
||||
}
|
||||
|
||||
func check(t *testing.T, file string) {
|
||||
|
|
|
|||
|
|
@ -444,8 +444,8 @@ func testOne(t *testing.T, pt ptrTest) {
|
|||
}
|
||||
defer os.RemoveAll(gopath)
|
||||
|
||||
src := filepath.Join(gopath, "src")
|
||||
if err := os.Mkdir(src, 0777); err != nil {
|
||||
src := filepath.Join(gopath, "src", "ptrtest")
|
||||
if err := os.MkdirAll(src, 0777); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
@ -490,6 +490,11 @@ func testOne(t *testing.T, pt ptrTest) {
|
|||
}
|
||||
}
|
||||
|
||||
gomod := fmt.Sprintf("module %s\n", filepath.Base(src))
|
||||
if err := ioutil.WriteFile(filepath.Join(src, "go.mod"), []byte(gomod), 0666); err != nil {
|
||||
t.Fatalf("writing go.mod: %v", err)
|
||||
}
|
||||
|
||||
args := func(cmd *exec.Cmd) string {
|
||||
return strings.Join(cmd.Args, " ")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue