Skip to content

Commit 694012a

Browse files
author
Bryan C. Mills
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Andrew Bonventre <[email protected]>
1 parent 9238a8f commit 694012a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cmd/cover/cover_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,9 @@ func TestFuncWithDuplicateLines(t *testing.T) {
540540
t.Fatal(err)
541541
}
542542

543+
if err := ioutil.WriteFile(filepath.Join(lineDupDir, "go.mod"), []byte("module linedup\n"), 0444); err != nil {
544+
t.Fatal(err)
545+
}
543546
if err := ioutil.WriteFile(lineDupGo, []byte(lineDupContents), 0444); err != nil {
544547
t.Fatal(err)
545548
}
@@ -554,7 +557,7 @@ func TestFuncWithDuplicateLines(t *testing.T) {
554557

555558
// testcover -func=TMPDIR/linedup.out
556559
cmd = exec.Command(testcover, "-func", lineDupProfile)
557-
cmd.Dir = testTempDir
560+
cmd.Dir = lineDupDir
558561
run(cmd, t)
559562
}
560563

0 commit comments

Comments
 (0)