platform

package
v0.0.0-...-d9bdf42 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Unlicense Imports: 1 Imported by: 0

Documentation

Overview

Package platform collects a list of platform names, codenames, and code characters.

When targeting specific platforms, it is preferable to have a list of standard codenames associated with them. However, considering that programs typically target specific CPU architectures and operating systems, the resultant platform designation may still be slightly too verbose for frequent use. This is why, aside from providing codenames for each supported platform, a code character is provided as well.

Index

Constants

This section is empty.

Variables

View Source
var (
	// CPU architectures
	Amd64    = Platform{'6', "amd64", "AMD64"}
	Arm      = Platform{'5', "arm", "little-endian ARM"}
	Arm64    = Platform{'7', "arm64", "little-endian ARM (64-bit)"}
	I386     = Platform{'8', "i386", "Intel 80386"}
	Loong64  = Platform{'ろ', "loong64", "Loongson (64-bit)"}
	M68k     = Platform{'も', "m68k", "Motorola 68000"}
	Mips     = Platform{'0', "mips", "big-endian MIPS32"}
	Mips64   = Platform{'1', "mips64", "big-endian MIPS64"}
	Mips64le = Platform{'2', "mips64le", "MIPS64 (little-endian)"}
	Mipsle   = Platform{'3', "mipsle", "MIPS32 (little-endian)"}
	Ppc      = Platform{'ほ', "ppc", "Power PC"}
	Ppc64    = Platform{'4', "ppc64", "Power PC (64-bit)"}
	Ppc64le  = Platform{'9', "ppc64le", "Power PC (64-bit, little-endian)"}
	Riscv64  = Platform{'り', "riscv64", "RISC-V (64-bit)"}
	S390x    = Platform{'せ', "s390x", "IBM z/Architecture"}
	Sparc64  = Platform{'さ', "sparc64", "SPARC V9"}
	// Operating systems
	Aix       = Platform{'x', "aix", "IBM AIX"}
	Android   = Platform{'a', "android", "Android"}
	Bare      = Platform{'b', "bare", "Bare metal"}
	Dragonfly = Platform{'d', "dragonfly", "DragonFly BSD"}
	Freebsd   = Platform{'f', "freebsd", "FreeBSD"}
	Illumos   = Platform{'m', "illumos", "Illumos"}
	Ios       = Platform{'i', "ios", "iOS"}
	Linux     = Platform{'l', "linux", "Linux"}
	Macos     = Platform{'m', "macos", "macOS"}
	Netbsd    = Platform{'n', "netbsd", "NetBSD"}
	Openbsd   = Platform{'o', "openbsd", "OpenBSD"}
	Plan9     = Platform{'p', "plan9", "Plan 9 from Bell Labs"}
	Solaris   = Platform{'s', "solaris", "Oracle Solaris"}
	Windows   = Platform{'w', "windows", "Windows NT"}
)

The following is a list of platform structures which provide code character, codename, and name associations for known platforms.

Arch is a slice of all known CPU architectures.

OS is a slice of all known operating systems.

Functions

This section is empty.

Types

type Platform

type Platform struct {
	CodeChar rune
	CodeName string
	Name     string
}

Platform represents a platform, whether it be a CPU architecture or an OS.

func Current

func Current() (arch, os Platform)

Return the current CPU architecture and OS.

func CurrentArch

func CurrentArch() Platform

Return the current CPU architecture.

func CurrentOS

func CurrentOS() Platform

Return the current OS.

func WithCodeChar

func WithCodeChar(p []Platform, r rune) Platform

WithCodeChar returns the first platform in p with the given code character r. If there are no matching platforms, returns an empty Platform.

func WithCodeName

func WithCodeName(p []Platform, s string) Platform

WithCodeName returns the first platform in p with the given code name r. If there are no matching platforms, returns an empty Platform.

func WithName

func WithName(p []Platform, s string) Platform

WithName returns the first platform in p with the given platform name s. If there are no matching platforms, returns an empty Platform.

Jump to

Keyboard shortcuts

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