v0.5.4 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2016 License: Apache-2.0 Imports: 4 Imported by: 0



Package kernel provides helper function to get, parse and compare kernel versions for different platforms.



This section is empty.


This section is empty.


func CompareKernelVersion

func CompareKernelVersion(a, b VersionInfo) int

CompareKernelVersion compares two kernel.VersionInfo structs. Returns -1 if a < b, 0 if a == b, 1 it a > b


type Utsname

type Utsname syscall.Utsname

Utsname represents the system name structure. It is passthgrouh for syscall.Utsname in order to make it portable with other platforms where it is not available.

type VersionInfo added in v0.5.2

type VersionInfo struct {
	Kernel int    // Version of the kernel (e.g. 4.1.2-generic -> 4)
	Major  int    // Major part of the kernel version (e.g. 4.1.2-generic -> 1)
	Minor  int    // Minor part of the kernel version (e.g. 4.1.2-generic -> 2)
	Flavor string // Flavor of the kernel version (e.g. 4.1.2-generic -> generic)

VersionInfo holds information about the kernel.

func GetKernelVersion

func GetKernelVersion() (*VersionInfo, error)

GetKernelVersion gets the current kernel version.

func ParseRelease

func ParseRelease(release string) (*VersionInfo, error)

ParseRelease parses a string and creates a VersionInfo based on it.

func (*VersionInfo) String added in v0.5.2

func (k *VersionInfo) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL