aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/cover/report.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-04-09 08:56:35 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-04-09 08:33:12 +0000
commitbf86f5aaada407ff2fed28fe03bc0b892caf4e41 (patch)
treeeda5a8bb70217931959c147901f049f9cedc6b90 /pkg/cover/report.go
parent828b7836fa16828b1972d47e38613c9fe72da36c (diff)
pkg/cover: move functions to after they are used
This makes code easier to read top-down in the natural order and Go does not require the inverted declaration order like C/C++.
Diffstat (limited to 'pkg/cover/report.go')
-rw-r--r--pkg/cover/report.go25
1 files changed, 12 insertions, 13 deletions
diff --git a/pkg/cover/report.go b/pkg/cover/report.go
index f52a2bcaa..4e7ec3001 100644
--- a/pkg/cover/report.go
+++ b/pkg/cover/report.go
@@ -76,19 +76,6 @@ type line struct {
pcProgCount map[uint64]int // some lines have multiple BBs
}
-func coverageCallbackMismatch(debug bool, numPCs int, unmatchedProgPCs map[uint64]bool) error {
- debugStr := ""
- if debug {
- debugStr += "\n\nUnmatched PCs:\n"
- for pc := range unmatchedProgPCs {
- debugStr += fmt.Sprintf("%x\n", pc)
- }
- }
- // nolint: lll
- return fmt.Errorf("%d out of %d PCs returned by kcov do not have matching coverage callbacks. Check the discoverModules() code.%s",
- len(unmatchedProgPCs), numPCs, debugStr)
-}
-
type fileMap map[string]*file
func (rg *ReportGenerator) prepareFileMap(progs []Prog, debug bool) (fileMap, error) {
@@ -181,6 +168,18 @@ func (rg *ReportGenerator) prepareFileMap(progs []Prog, debug bool) (fileMap, er
return files, nil
}
+func coverageCallbackMismatch(debug bool, numPCs int, unmatchedProgPCs map[uint64]bool) error {
+ debugStr := ""
+ if debug {
+ debugStr += "\n\nUnmatched PCs:\n"
+ for pc := range unmatchedProgPCs {
+ debugStr += fmt.Sprintf("%x\n", pc)
+ }
+ }
+ return fmt.Errorf("%d out of %d PCs returned by kcov do not have matching coverage callbacks."+
+ " Check the discoverModules() code.%s", len(unmatchedProgPCs), numPCs, debugStr)
+}
+
func uniquePCs(progs []Prog) []uint64 {
PCs := make(map[uint64]bool)
for _, p := range progs {