Open LYF123123 opened 3 years ago
https://github.com/shirou/gopsutil/pull/541#issuecomment-401195949 on how to do that
https://github.com/shirou/gopsutil/issues/435 was auto-closed by #541 being merged, but this PR was then reverted and the issue not reopened.
I also encountered the same problem, after I read the #541 , I don't know how to get disk sn finally, I can't find the method disk.GetDiskSerialNumber and no demo show me how to get it, and IOCountersStat in each name print empty serial number.
after run the code below, I can get disk name, but can't get disk serial number.
mapCountStats, err := disk.IOCounters("")
if err != nil {
fmt.Printf("disk IOCounters err: %v\n", err)
return
}
for k, v := range mapCountStats {
fmt.Printf("key: %v, name:%v, serialNum:%v\n", k, v.Name, v.SerialNumber)
}
the output is this:
key: D:, name:D:, serialNum:
key: E:, name:E:, serialNum:
key: F:, name:F:, serialNum:
key: C:, name:C:, serialNum:
and serialNum is empty, is there are something wrong with my code? please give me some suggestions, thanks a lot.
Like the title, gopsutil now don not support though "GetDiskSerailNumber" to get disk serial number on windows