Skip to content

Commit

Permalink
Merge bccdb98 into 46eb9e6
Browse files Browse the repository at this point in the history
  • Loading branch information
IfanTsai authored Sep 27, 2023
2 parents 46eb9e6 + bccdb98 commit 6db3b82
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cover/internal/tool/cover.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package tool

import (
"bytes"
"strings"

// "flag"
"fmt"
"go/ast"
Expand Down Expand Up @@ -342,6 +344,8 @@ func Annotate(name string, mode string, varVar string, globalCoverVarImportPath

if bytes.Equal(content, newContent) {
log.Info("no cover var injected for: ", name)
} else if strings.Contains(string(file.content), globalCoverVarImportPath) {
log.Info("global cover var already imported for: ", name)
} else {
// reback to the beginning
file.astFile, _ = parser.ParseFile(fset, name, content, parser.ParseComments)
Expand Down

0 comments on commit 6db3b82

Please sign in to comment.