Skip to content

Commit 6f3fa6f

Browse files
committed
add a debug message
1 parent dc96ac6 commit 6f3fa6f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/leeway/build.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,8 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
12651265
testCommand = append(testCommand, fmt.Sprintf("-coverprofile=%v", codecovComponentName(p.FullName())))
12661266
} else {
12671267
testCommand = append(testCommand, "-coverprofile=testcoverage.out")
1268-
reportCoverage = collectGoTestCoverage(filepath.Join(wd, "testcoverage.out"), p.FullName(), buildctx.buildDir)
1268+
testCommand = append(testCommand, "-coverprofile=testcoverage.out")
1269+
reportCoverage = collectGoTestCoverage(filepath.Join(wd, "testcoverage.out"), p.FullName())
12691270
}
12701271
testCommand = append(testCommand, "./...")
12711272

@@ -1300,14 +1301,15 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
13001301
}, nil
13011302
}
13021303

1303-
func collectGoTestCoverage(covfile, fullName, cwd string) testCoverageFunc {
1304+
func collectGoTestCoverage(covfile, fullName string) testCoverageFunc {
13041305
return func() (coverage, funcsWithoutTest, funcsWithTest int, err error) {
13051306
// We need to collect the coverage for all packages in the module.
13061307
// To that end we load the coverage file.
13071308
// The coverage file contains the coverage for all packages in the module.
13081309

13091310
cmd := exec.Command("go", "tool", "cover", "-func", covfile)
1310-
cmd.Dir = cwd
1311+
log.WithField("pwd", filepath.Dir(covfile)).WithField("covfile", covfile).Debug("collecting test coverage")
1312+
cmd.Dir = filepath.Dir(covfile)
13111313
out, err := cmd.CombinedOutput()
13121314
if err != nil {
13131315
err = xerrors.Errorf("cannot collect test coverage: %w: %s", err, string(out))

0 commit comments

Comments
 (0)