@@ -737,24 +737,26 @@ func ParseGres(gres string) *protos.DeviceMap {
737
737
}
738
738
739
739
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 {
743
741
return "None"
744
742
}
745
743
746
744
var result strings.Builder
747
- isFirstDevice := true
745
+ isFirstDevice := true
748
746
749
747
for deviceName , typeCountMap := range resourceView .DeviceMap .NameTypeMap {
750
748
if ! isFirstDevice {
751
749
result .WriteString ("; " )
752
750
} else {
753
751
isFirstDevice = false
754
752
}
755
- result .WriteString (fmt .Sprintf ("%s:" , deviceName ))
753
+
754
+ result .WriteString (deviceName )
755
+ result .WriteString (":" )
756
+
756
757
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 ))
758
760
}
759
761
760
762
isFirstType := typeCountMap .Total == 0
@@ -765,7 +767,9 @@ func GetDeviceMapStr(resourceView *protos.ResourceView) string {
765
767
isFirstType = false
766
768
}
767
769
768
- result .WriteString (fmt .Sprintf ("%s:%d" , typeName , count ))
770
+ result .WriteString (typeName )
771
+ result .WriteString (":" )
772
+ result .WriteString (strconv .FormatUint (count , 10 ))
769
773
}
770
774
}
771
775
0 commit comments