Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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