Skip to content

Commit f280790

Browse files
6543lunny
authored andcommitted
debug issue
1 parent 7694598 commit f280790

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

build/gocovmerge.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"log"
1919
"os"
2020
"sort"
21+
"strings"
2122

2223
"golang.org/x/tools/cover"
2324
)
@@ -109,7 +110,26 @@ func main() {
109110
for _, file := range flag.Args() {
110111
profiles, err := cover.ParseProfiles(file)
111112
if err != nil {
112-
log.Fatalf("failed to parse profiles: %v", err)
113+
114+
// for testing only
115+
f, _ := os.Open(file)
116+
defer f.Close()
117+
scanner := bufio.NewScanner(f)
118+
i := 0
119+
lines := []string{}
120+
for scanner.Scan() {
121+
if i > 10 {
122+
break
123+
}
124+
i++
125+
lines = append(lines, scanner.Text())
126+
}
127+
fmt.Println("=== " + file + " ==============================")
128+
fmt.Printf("%s\n", strings.Join(lines, "\n"))
129+
fmt.Println("===============================================")
130+
// end
131+
132+
log.Fatalf("failed to parse profile '%s': %v", file, err)
113133
}
114134
for _, p := range profiles {
115135
merged = addProfile(merged, p)

0 commit comments

Comments
 (0)