normalizePath converts all backslashes to forward slashes and removes trailing slashes. We can't use filepath.ToSlash() as this code always runs inside a Linux container.
(path string)
| 37 | // normalizePath converts all backslashes to forward slashes and removes trailing slashes. |
| 38 | // We can't use filepath.ToSlash() as this code always runs inside a Linux container. |
| 39 | func normalizePath(path string) string { |
| 40 | path = filepath.Clean(path) |
| 41 | path = strings.ReplaceAll(path, "\\", "/") |
| 42 | path = strings.TrimSuffix(path, "/") |
| 43 | if path == "" { |
| 44 | path = "/" |
| 45 | } |
| 46 | return path |
| 47 | } |
| 48 | |
| 49 | // GetDrive extracts the drive letter or UNC share from a path. |
| 50 | func GetDrive(path string) string { |
no outgoing calls
no test coverage detected