Commit 1ca8c64

Karn Wong <[email protected]>
2025-12-04 09:13:44
fix(getHwInfo): unknown memory type will not be displayed
1 parent ae67105
Changed files (1)
internal
internal/get/hwinfo.go
@@ -42,11 +42,13 @@ func HwInfo() {
 	}
 
 	for _, i := range memoryDevices {
-		fmt.Printf("  - %s: %s\n", color.Blue("Manufacturer"), i.Manufacturer)
-		fmt.Printf("    %s: %s\n", color.Blue("Type"), i.Type)
-		fmt.Printf("    %s: %v GB\n", color.Blue("Size"), i.Size/1024)
-		fmt.Printf("    %s: %v MHz\n", color.Blue("Speed"), i.Speed)
-		fmt.Printf("    %s: %s \n", color.Blue("Model"), i.PartNumber)
+		if i.Type.String() != "Unknown" {
+			fmt.Printf("  - %s: %s\n", color.Blue("Manufacturer"), i.Manufacturer)
+			fmt.Printf("    %s: %s\n", color.Blue("Type"), i.Type)
+			fmt.Printf("    %s: %v GB\n", color.Blue("Size"), i.Size/1024)
+			fmt.Printf("    %s: %v MHz\n", color.Blue("Speed"), i.Speed)
+			fmt.Printf("    %s: %s \n", color.Blue("Model"), i.PartNumber)
+		}
 	}
 
 	// disk