Skip to content

Commit 4c5dc70

Browse files
committed
fix comments
1 parent bc64375 commit 4c5dc70

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

internal/util/string.go

+11-7
Original file line numberDiff line numberDiff line change
@@ -737,24 +737,26 @@ func ParseGres(gres string) *protos.DeviceMap {
737737
}
738738

739739
func GetDeviceMapStr(resourceView *protos.ResourceView) string {
740-
if resourceView.DeviceMap == nil ||
741-
resourceView.DeviceMap.NameTypeMap == nil ||
742-
len(resourceView.DeviceMap.NameTypeMap) == 0 {
740+
if resourceView.DeviceMap == nil || resourceView.DeviceMap.NameTypeMap == nil || len(resourceView.DeviceMap.NameTypeMap) == 0 {
743741
return "None"
744742
}
745743

746744
var result strings.Builder
747-
isFirstDevice := true
745+
isFirstDevice := true
748746

749747
for deviceName, typeCountMap := range resourceView.DeviceMap.NameTypeMap {
750748
if !isFirstDevice {
751749
result.WriteString("; ")
752750
} else {
753751
isFirstDevice = false
754752
}
755-
result.WriteString(fmt.Sprintf("%s:", deviceName))
753+
754+
result.WriteString(deviceName)
755+
result.WriteString(":")
756+
756757
if typeCountMap.Total > 0 {
757-
result.WriteString(fmt.Sprintf("untyped:%d", typeCountMap.Total))
758+
result.WriteString("untyped:")
759+
result.WriteString(strconv.FormatUint(typeCountMap.Total, 10))
758760
}
759761

760762
isFirstType := typeCountMap.Total == 0
@@ -765,7 +767,9 @@ func GetDeviceMapStr(resourceView *protos.ResourceView) string {
765767
isFirstType = false
766768
}
767769

768-
result.WriteString(fmt.Sprintf("%s:%d", typeName, count))
770+
result.WriteString(typeName)
771+
result.WriteString(":")
772+
result.WriteString(strconv.FormatUint(count, 10))
769773
}
770774
}
771775

0 commit comments

Comments
 (0)