Skip to content

Commit

Permalink
chore: Refactor getDiskName function to simplify code in utils.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehco1996 committed Apr 29, 2024
1 parent 9b23b89 commit 527fae2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/node_metric/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ var (

func getDiskName(devicePath string) string {
matches := diskNameRegex.FindStringSubmatch(devicePath)
if matches != nil {
for _, match := range matches {
if match != "" {
return match
}
for _, match := range matches {
if match != "" {
return match
}
}
return ""
Expand Down

0 comments on commit 527fae2

Please sign in to comment.