kernel version - don't show the dash if flavor is empty

This commit is contained in:
unclejack 2013-05-07 20:57:21 +03:00
parent f46ab22b7a
commit d2eb2455a1
1 changed files with 5 additions and 1 deletions

View File

@ -425,7 +425,11 @@ func GetKernelVersion() (*KernelVersionInfo, error) {
}
func (k *KernelVersionInfo) String() string {
return fmt.Sprintf("%d.%d.%d-%s", k.Kernel, k.Major, k.Minor, k.Flavor)
flavor := ""
if len(k.Flavor) > 0 {
flavor = fmt.Sprintf("-%s", k.Flavor)
}
return fmt.Sprintf("%d.%d.%d%s", k.Kernel, k.Major, k.Minor, flavor)
}
// Compare two KernelVersionInfo struct.