kernel

package
v25.0.15+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 455 modules, 1,318 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckKernelVersion added in v1.13.0

func CheckKernelVersion(k, major, minor int) bool

CheckKernelVersion checks if current kernel is newer than (or equal to) the given version.

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

Types

type VersionInfo added in v1.9.0

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 v1.9.0

func (k *VersionInfo) String() string

Jump to

Keyboard shortcuts

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