Skip to content

Commit c31beee

Browse files
committed
add verbose
1 parent cf1a99a commit c31beee

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

cmd/diff-cov/diff-cov.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func main() {
100100

101101
ignoreFiles := strings.Split(flagIgnoreFiles, ",")
102102
profile := coverprofile.NewGoProfile(flagPackage, flagCoverProfile)
103-
coverage, err := profile.GetCoverage(ignoreFiles)
103+
coverage, err := profile.GetCoverage(ignoreFiles, flagVerbose)
104104
if err != nil {
105105
fmt.Println(err)
106106
os.Exit(1)

diffCoverage/coverage.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func Calculate(coverage profile.Coverage, diff string, ignoreFiles []string, ver
1818

1919
for file, changes := range p.Changed() {
2020
if !utils.ShouldCountFile(file, ignoreFiles) {
21+
if verbose {
22+
fmt.Printf("Ignoring %q\n", file)
23+
}
2124
continue
2225
}
2326
if verbose {

profile/coverprofile/coverprofile.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func NewGoProfile(packageName string, profilePath string) *GoProfile {
2020
}
2121
}
2222

23-
func (g GoProfile) GetCoverage(ignoreFiles []string) (profile.Coverage, error) {
23+
func (g GoProfile) GetCoverage(ignoreFiles []string, verbose bool) (profile.Coverage, error) {
2424
ps, err := cover.ParseProfiles(g.profilePath)
2525
if err != nil {
2626
return nil, fmt.Errorf("Error parsing %q: %v\n", g.profilePath, err)
@@ -29,6 +29,9 @@ func (g GoProfile) GetCoverage(ignoreFiles []string) (profile.Coverage, error) {
2929
coverage := make(profile.Coverage, len(ps))
3030
for _, p := range ps {
3131
if !utils.ShouldCountFile(p.FileName, ignoreFiles) {
32+
if verbose {
33+
fmt.Printf("Ignoring %q\n", p.FileName)
34+
}
3235
continue
3336
}
3437

0 commit comments

Comments
 (0)