Skip to content

Commit

Permalink
cmd/cover: add go.mod file in lineDupDir
Browse files Browse the repository at this point in the history
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: Andrew Bonventre <andybons@golang.org>
  • Loading branch information
Bryan C. Mills committed Mar 15, 2019
1 parent 9238a8f commit 694012a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cmd/cover/cover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,9 @@ func TestFuncWithDuplicateLines(t *testing.T) {
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 {
t.Fatal(err)
}
Expand All @@ -554,7 +557,7 @@ func TestFuncWithDuplicateLines(t *testing.T) {

// testcover -func=TMPDIR/linedup.out
cmd = exec.Command(testcover, "-func", lineDupProfile)
cmd.Dir = testTempDir
cmd.Dir = lineDupDir
run(cmd, t)
}

Expand Down

0 comments on commit 694012a

Please sign in to comment.