Commit 694012aa authored by Bryan C. Mills's avatar Bryan C. Mills

cmd/cover: add go.mod file in lineDupDir

This fixes TestFuncWithDuplicateLines (introduced in CL 167257)
in module mode.

Updates #30746
Updates #30228

Change-Id: I7b3e7192ae23f855c373e881389874ff6ffd49ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/167740
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
parent 9238a8ff
...@@ -540,6 +540,9 @@ func TestFuncWithDuplicateLines(t *testing.T) { ...@@ -540,6 +540,9 @@ func TestFuncWithDuplicateLines(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if err := ioutil.WriteFile(filepath.Join(lineDupDir, "go.mod"), []byte("module linedup\n"), 0444); err != nil {
t.Fatal(err)
}
if err := ioutil.WriteFile(lineDupGo, []byte(lineDupContents), 0444); err != nil { if err := ioutil.WriteFile(lineDupGo, []byte(lineDupContents), 0444); err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -554,7 +557,7 @@ func TestFuncWithDuplicateLines(t *testing.T) { ...@@ -554,7 +557,7 @@ func TestFuncWithDuplicateLines(t *testing.T) {
// testcover -func=TMPDIR/linedup.out // testcover -func=TMPDIR/linedup.out
cmd = exec.Command(testcover, "-func", lineDupProfile) cmd = exec.Command(testcover, "-func", lineDupProfile)
cmd.Dir = testTempDir cmd.Dir = lineDupDir
run(cmd, t) run(cmd, t)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment