Skip to content

Commit cdc9e33

Browse files
authored
Merge pull request kubernetes#90337 from gaurav1086/aws_use_TrimPrefix
[Provider/aws] use strings.TrimPrefix()
2 parents d3d870f + 033f94e commit cdc9e33

File tree

1 file changed

+2
-6
lines changed
  • staging/src/k8s.io/legacy-cloud-providers/aws

1 file changed

+2
-6
lines changed

staging/src/k8s.io/legacy-cloud-providers/aws/aws.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,12 +1884,8 @@ func (c *Cloud) getMountDevice(
18841884
volumeStatus := map[EBSVolumeID]string{} // for better logging of volume status
18851885
for _, blockDevice := range info.BlockDeviceMappings {
18861886
name := aws.StringValue(blockDevice.DeviceName)
1887-
if strings.HasPrefix(name, "/dev/sd") {
1888-
name = name[7:]
1889-
}
1890-
if strings.HasPrefix(name, "/dev/xvd") {
1891-
name = name[8:]
1892-
}
1887+
name = strings.TrimPrefix(name, "/dev/sd")
1888+
name = strings.TrimPrefix(name, "/dev/xvd")
18931889
if len(name) < 1 || len(name) > 2 {
18941890
klog.Warningf("Unexpected EBS DeviceName: %q", aws.StringValue(blockDevice.DeviceName))
18951891
}

0 commit comments

Comments
 (0)