File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
pkg/testcoverage/coverage Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package coverage
2
2
3
3
import (
4
4
"bufio"
5
+ "fmt"
5
6
"os"
6
7
"path/filepath"
7
8
"strings"
@@ -10,10 +11,16 @@ import (
10
11
func findModuleDirective (rootDir string ) string {
11
12
goModFile := findGoModFile (rootDir )
12
13
if goModFile == "" {
14
+ fmt .Printf ("could not find go.mod file in root dir: %s\n " , rootDir )
13
15
return ""
14
16
}
15
17
16
- return readModuleDirective (goModFile )
18
+ module := readModuleDirective (goModFile )
19
+ if module == "" {
20
+ fmt .Println ("`module` directive not found" )
21
+ }
22
+
23
+ return module
17
24
}
18
25
19
26
func findGoModFile (rootDir string ) string {
@@ -45,7 +52,7 @@ func readModuleDirective(filename string) string {
45
52
46
53
scanner := bufio .NewScanner (file )
47
54
for scanner .Scan () {
48
- line := scanner .Text ()
55
+ line := strings . TrimSpace ( scanner .Text () )
49
56
if strings .HasPrefix (line , "module " ) {
50
57
return strings .TrimSpace (strings .TrimPrefix (line , "module " ))
51
58
}
You can’t perform that action at this time.
0 commit comments