platform

package
v0.1.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPlatform = errors.New("invalid platform")

ErrInvalidPlatform represents a platform value error.

SupportedPlatforms contains all supported platforms.

View Source
var ValidPlatformValues = append([]Platform{All}, SupportedPlatforms...)

ValidPlatformValues validates flag values.

Functions

func IsValid

func IsValid(s string) bool

IsValid reports if s is a valid platform.

func NewErrInvalidPlatform

func NewErrInvalidPlatform(value string) error

NewErrInvalidPlatform wraps ErrInvalidPlatform with the invalid platform value.

func Satisfies

func Satisfies(plat Platform, constraint Platform) bool

Satisfies simply checks if the given platform satisfies the constraint. The selected platform will not exceed the constraint.

func SatisfiesOCI

func SatisfiesOCI(ociplat *ocispec.Platform, constraint Platform) bool

SatisfiesOCI checks if the given OCI image platform satisfies the constraint. The selected platform will not exceed the constraint.

func SelectIndex

func SelectIndex(candidates []Platform, constraint Platform) int

SelectIndex selects the most viable platform from a list of candidate platforms. The returned index will be -1 if a compatible platform is not found. The selected platform will not exceed the constraint.

func SelectManifest

func SelectManifest(index *ocispec.Index, constraint Platform) (ocispec.Descriptor, error)

SelectManifest selects the most viable manifest from an OCI image index. The returned index will be -1 if a compatible image is not found. The selected platform will not exceed the constraint.

func SelectManifestIndex

func SelectManifestIndex(index *ocispec.Index, constraint Platform) int

SelectManifestIndex selects the most viable manifest from an OCI image index. The returned index will be -1 if a compatible image is not found. The selected platform will not exceed the constraint.

Types

type Platform

type Platform string

Platform defines a platform.

const (
	Arm64Sonoma   Platform = "arm64_sonoma"   // macOS Sonoma ARM 64-bit
	Arm64Ventura  Platform = "arm64_ventura"  // macOS Sonoma ARM 64-bit
	Arm64Monterey Platform = "arm64_monterey" // macOS Sonoma ARM 64-bit
	Arm64BigSur   Platform = "arm64_big_sur"  // macOS Sonoma ARM 64-bit
	Sonoma        Platform = "sonoma"         // macOS Sonoma x86 64-bit
	Ventura       Platform = "ventura"        // macOS Ventura x86 64-bit
	Monterey      Platform = "monterey"       // macOS Monterey x86 64-bit
	BigSur        Platform = "big_sur"        // macOS Big Sur x86 64-bit
	Catalina      Platform = "catalina"       // macOS Catalina x86 64-bit
	Mojave        Platform = "mojave"         // macOS Mojave x86 64-bit
	HighSierra    Platform = "high_sierra"    // macOS High Sierra x86 64-bit
	X8664Linux    Platform = "x86_64_linux"   // Linux x86 64-bit
	All           Platform = "all"            // All platforms
	Unsupported   Platform = ""               // Unsupported platform (hops defined)
)

func FromOCI

func FromOCI(r *ocispec.Platform) Platform

Converts platform to OCI platform.

func SystemPlatform

func SystemPlatform() Platform

SystemPlatform detects the host's platform.

func (Platform) ARM

func (p Platform) ARM() Platform

ARM produces the corresponding ARM version of the platform.

func (Platform) Computed

func (p Platform) Computed() []Platform

Computed computes the actual included platforms for a Platform value.

func (*Platform) Set

func (p *Platform) Set(s string) error

Set implements pflag.Value.

func (Platform) String

func (p Platform) String() string

String implements the fmt.Stringer interface.

func (Platform) Type

func (p Platform) Type() string

Type implements pflag.Value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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