platform

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 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

Index

Constants

View Source
const (
	LinuxTag = uint32(iota) << platformShift
	WindowsTag
)

Values used to tag platform specific constants.

The value for Linux is zero so that existing constants do not change.

View Source
const (
	Linux   = "linux"
	Windows = "windows"
)
View Source
const (
	IsLinux   = runtime.GOOS == "linux"
	IsWindows = runtime.GOOS == "windows"
)
View Source
const Native = Linux

Variables

This section is empty.

Functions

func DecodeConstant

func DecodeConstant[T ~uint32](c T) (string, uint32)

Decode a platform and a value from a tagged constant.

func EncodeConstant

func EncodeConstant[T ~uint32](platform string, c uint32) (T, error)

Encode a platform and a value into a tagged constant.

Returns an error if platform is unknown or c is out of bounds.

func SelectVersion

func SelectVersion(versions []string) (string, error)

SelectVersion extracts the platform-appropriate version from a list of strings like `linux:6.1` or `windows:0.20.0`.

Returns an empty string and nil if no version matched or an error if no strings were passed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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