osversion

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package osversion returns a one-line human-readable OS version label for the running host, e.g. "macOS 15.1.0" / "Ubuntu 24.04 LTS" / "Windows 11 Pro 26100". Distinct from the compile-time runtime.GOOS ("darwin" / "linux" / "windows") in two important ways:

  1. It reflects the actual host OS at runtime, not the binary's build target. A darwin binary scp'd to a linux box would still report runtime.GOOS=="darwin" but couldn't actually start there; this package gives cloudbox the real story.
  2. It includes the version/distribution, useful for the SPA's "running where" display ("macOS 15.1" beats "darwin").

Cached on first call — host OS version doesn't change at process lifetime, and the underlying calls (sw_vers / /etc/os-release / ver) are exec/IO heavy enough that we don't want to repeat them per poll.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String() string

String returns the cached one-line OS version label. Falls back to runtime.GOOS when the platform-specific lookup fails or isn't implemented (BSDs, Solaris, etc).

Types

This section is empty.

Jump to

Keyboard shortcuts

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