Skip to content

Commit 89e3b2f

Browse files
committed
add path file
1 parent 4e50bad commit 89e3b2f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/testcoverage/path/path.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package path
2+
3+
import (
4+
"path/filepath"
5+
"runtime"
6+
"strings"
7+
)
8+
9+
const separatorToReplace = string(filepath.Separator)
10+
11+
func NormalizePathInRegex(path string) string {
12+
if runtime.GOOS != "windows" {
13+
return path
14+
}
15+
16+
return strings.ReplaceAll(path, "/", separatorToReplace) // coverage-ignore
17+
}

0 commit comments

Comments
 (0)