volume/mounts: windowsDetectMountType: rewrite using switch

Mostly for readability, and to avoid linters suggesting to move the
default condition outside of the if/else.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-06-10 13:19:25 +02:00
parent 027355d7b3
commit 0069360e3b

View File

@@ -167,11 +167,12 @@ func windowsValidateAbsolute(p string) error {
}
func windowsDetectMountType(p string) mount.Type {
if strings.HasPrefix(p, `\\.\pipe\`) {
switch {
case strings.HasPrefix(p, `\\.\pipe\`):
return mount.TypeNamedPipe
} else if hostDirRegexp.MatchString(p) {
case hostDirRegexp.MatchString(p):
return mount.TypeBind
} else {
default:
return mount.TypeVolume
}
}