66 "strings"
77
88 "golang.org/x/tools/cover"
9+
10+ "github.com/vladopajic/go-test-coverage/v2/pkg/testcoverage/logger"
911)
1012
1113func parseProfiles (paths []string ) ([]* cover.Profile , error ) {
@@ -64,7 +66,14 @@ func findProfileForFile(profiles []*cover.Profile, file string) (int, bool) {
6466
6567func mergeSameFileProfile (ap , bp * cover.Profile ) (* cover.Profile , error ) {
6668 if len (ap .Blocks ) != len (bp .Blocks ) {
67- return nil , fmt .Errorf ("inconsistent profiles length [%q, %q]" , ap .FileName , bp .FileName )
69+ logger .L .Debug ().
70+ Str ("a-file" , ap .FileName ).
71+ Str ("b-file" , bp .FileName ).
72+ Int ("a-len" , len (ap .Blocks )).
73+ Int ("b-len" , len (bp .Blocks )).
74+ Msg ("inconsistent profile length" )
75+
76+ return nil , fmt .Errorf ("inconsistent profiles length [%q]" , ap .FileName )
6877 }
6978
7079 for i := range ap .Blocks {
@@ -77,7 +86,14 @@ func mergeSameFileProfile(ap, bp *cover.Profile) (*cover.Profile, error) {
7786 b .NumStmt == a .NumStmt {
7887 ap .Blocks [i ].Count = max (a .Count , b .Count )
7988 } else {
80- return nil , fmt .Errorf ("inconsistent profile data [%q, %q]" , ap .FileName , bp .FileName )
89+ logger .L .Debug ().
90+ Str ("a-file" , ap .FileName ).
91+ Str ("b-file" , bp .FileName ).
92+ Interface ("a-block" , a ).
93+ Interface ("b-block" , b ).
94+ Msg ("inconsistent profile data" )
95+
96+ return nil , fmt .Errorf ("inconsistent profile data [%q]" , ap .FileName )
8197 }
8298 }
8399
0 commit comments