@@ -9,10 +9,12 @@ import (
9
9
"testing"
10
10
)
11
11
12
+ // SkipOnWindows skip test on Windows.
12
13
func SkipOnWindows (tb testing.TB ) {
13
14
tb .Skip ("not supported on Windows" )
14
15
}
15
16
17
+ // NormalizeFilePathInJSON find Go file path and replace `/` by `\\\\`.
16
18
func NormalizeFilePathInJSON (in string ) string {
17
19
exp := regexp .MustCompile (`(?:^|\b)[\w-/.]+\.go` )
18
20
@@ -21,15 +23,17 @@ func NormalizeFilePathInJSON(in string) string {
21
23
})
22
24
}
23
25
24
- func defaultBinaryName () string {
25
- return filepath .Join (".." , "golangci-lint.exe" )
26
- }
27
-
28
- // NormalizeFileInString normalizes in quoted string, ie. `\\\\`.
26
+ // NormalizeFileInString normalizes in quoted string, ie. replace `\\` by `\\\\`.
29
27
func NormalizeFileInString (in string ) string {
30
28
return strings .ReplaceAll (filepath .FromSlash (in ), "\\ " , "\\ \\ " )
31
29
}
32
30
31
+ // defaultBinaryName returns the path to the default binary.
32
+ func defaultBinaryName () string {
33
+ return filepath .Join (".." , "golangci-lint.exe" )
34
+ }
35
+
36
+ // normalizeFilePath find Go file path and replace `/` by `\\`.
33
37
func normalizeFilePath (in string ) string {
34
38
exp := regexp .MustCompile (`(?:^|\b)[\w-/.]+\.go` )
35
39
@@ -38,9 +42,10 @@ func normalizeFilePath(in string) string {
38
42
})
39
43
}
40
44
41
- // normalizeFilePathInRegex normalizes path in regular expressions.
42
- func normalizeFilePathInRegex (path string ) string {
43
- // This replacing should be safe because "/" are disallowed in Windows
44
- // https://docs.microsoft.com/windows/win32/fileio/naming-a-file
45
+ // normalizePathInRegex normalizes path in regular expressions.
46
+ // Replace all `/` by `\\`.
47
+ // This replacing should be safe because "/" are disallowed in Windows
48
+ // https://docs.microsoft.com/windows/win32/fileio/naming-a-file
49
+ func normalizePathInRegex (path string ) string {
45
50
return strings .ReplaceAll (path , "/" , regexp .QuoteMeta (string (filepath .Separator )))
46
51
}
0 commit comments