Help us shape the future of Go! Take the 2026 Go Developer Survey

sysinfo

package
v1.47.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LookPath is mockable for testing.
	LookPath = exec.LookPath
	// ReadFile is mockable for testing.
	ReadFile = os.ReadFile
	// RuntimeGOOS is mockable for testing.
	RuntimeGOOS = runtime.GOOS
	// OSReleasePaths are the standard paths checked for distro identification.
	OSReleasePaths = []string{"/etc/os-release", "/usr/lib/os-release"}
)

Functions

func HasApt

func HasApt() bool

HasApt returns true if 'apt-get' or 'apt' is on PATH.

func HasBrew

func HasBrew() bool

HasBrew returns true if the 'brew' executable is on PATH.

func HasDNF

func HasDNF() bool

HasDNF returns true if 'dnf' or 'dnf5' is on PATH.

func HasDocker

func HasDocker() bool

HasDocker returns true if the 'docker' executable is on PATH.

func HasFlatpak

func HasFlatpak() bool

HasFlatpak returns true if the 'flatpak' executable is on PATH.

Types

type DistroInfo

type DistroInfo struct {
	ID         string
	IDLike     []string
	VersionID  string
	Name       string
	PrettyName string
	RawOS      string // runtime.GOOS
}

DistroInfo contains parsed distribution information from /etc/os-release.

func Detect

func Detect() DistroInfo

Detect probes the operating system and Linux distribution metadata.

func (DistroInfo) IsDebianUbuntu

func (d DistroInfo) IsDebianUbuntu() bool

IsDebianUbuntu returns true if running on Ubuntu, Debian, or derivative.

func (DistroInfo) IsFedora

func (d DistroInfo) IsFedora() bool

IsFedora returns true if running on Fedora or RHEL/CentOS family.

func (DistroInfo) IsLinux

func (d DistroInfo) IsLinux() bool

IsLinux returns true if running on Linux.

func (DistroInfo) IsMacOS

func (d DistroInfo) IsMacOS() bool

IsMacOS returns true if running on Darwin/macOS.

func (DistroInfo) IsRaspberryPi

func (d DistroInfo) IsRaspberryPi() bool

IsRaspberryPi returns true if running on Raspbian / Raspberry Pi OS.

Jump to

Keyboard shortcuts

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