@@ -1265,7 +1265,8 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
1265
1265
testCommand = append (testCommand , fmt .Sprintf ("-coverprofile=%v" , codecovComponentName (p .FullName ())))
1266
1266
} else {
1267
1267
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 ())
1269
1270
}
1270
1271
testCommand = append (testCommand , "./..." )
1271
1272
@@ -1300,14 +1301,15 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
1300
1301
}, nil
1301
1302
}
1302
1303
1303
- func collectGoTestCoverage (covfile , fullName , cwd string ) testCoverageFunc {
1304
+ func collectGoTestCoverage (covfile , fullName string ) testCoverageFunc {
1304
1305
return func () (coverage , funcsWithoutTest , funcsWithTest int , err error ) {
1305
1306
// We need to collect the coverage for all packages in the module.
1306
1307
// To that end we load the coverage file.
1307
1308
// The coverage file contains the coverage for all packages in the module.
1308
1309
1309
1310
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 )
1311
1313
out , err := cmd .CombinedOutput ()
1312
1314
if err != nil {
1313
1315
err = xerrors .Errorf ("cannot collect test coverage: %w: %s" , err , string (out ))
0 commit comments