Thanks to visit codestin.com
Credit goes to pkg.go.dev

platform

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 4 Imported by: 0

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