optimize ifelse

This commit is contained in:
demoManito 2022-09-05 18:53:52 +08:00
parent bcea98234f
commit e1a5e8537a

View File

@ -211,7 +211,9 @@ func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, dev
mounter := attacher.host.GetMounter(awsElasticBlockStorePluginName) mounter := attacher.host.GetMounter(awsElasticBlockStorePluginName)
notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath) notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath)
if err != nil { if err != nil {
if os.IsNotExist(err) { if !os.IsNotExist(err) {
return err
}
dir := deviceMountPath dir := deviceMountPath
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
// On Windows, FormatAndMount will mklink (create a symbolic link) at deviceMountPath later, so don't create a // On Windows, FormatAndMount will mklink (create a symbolic link) at deviceMountPath later, so don't create a
@ -225,9 +227,6 @@ func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, dev
return fmt.Errorf("making dir %s failed with %s", dir, err) return fmt.Errorf("making dir %s failed with %s", dir, err)
} }
notMnt = true notMnt = true
} else {
return err
}
} }
volumeSource, readOnly, err := getVolumeSource(spec) volumeSource, readOnly, err := getVolumeSource(spec)