osarch

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("invalid os-arch")

ErrInvalid is returned when a string representation of Pair is invalid

Functions

func AltArch

func AltArch(arch string) string

AltArch maps arch values to an alternative representations - 386 -> x32 - amd64 -> x64 - arm -> arm32 - arm64 -> arm64 (noop)

func NormArch

func NormArch(arch string) string

NormArch maps alternative arch representations to GO-compatible arch names

func SameArch

func SameArch(a, b string) bool

SameArch checks if the two arch names refer to the same arch

Types

type Pair

type Pair struct {
	OS   string
	Arch string
}

Pair contains a OS, architecture pair, typically pulled from runtime.GOOS and runtime.GOARCH

func MustParse

func MustParse(s string) Pair

MustParse is like Parse, but panics isth string cannot be parsed

func Parse

func Parse(s string) (Pair, error)

Parse parses a string into Pair

func ParseList

func ParseList(ss ...string) ([]Pair, error)

ParseList parses one or more strings with comma-separated list of arches into a set of pairs, also supports some predefined values. All targets are normalized and only unique entries are returned.

func This

func This() Pair

This returns runtime.GOOS, runtime.GOARCH pair, This is the pair for which the compiler is currently building

func (Pair) Alted

func (oa Pair) Alted() Pair

Alted converts Pair to its alternative representation

func (Pair) ExeExt

func (oa Pair) ExeExt() string

ExeExt returns default executable file extension for the target OS

func (*Pair) MarshalJSON

func (oa *Pair) MarshalJSON() (bb []byte, err error)

MarshalJSON is used when writing Pair into JSON streams

func (*Pair) MarshalText

func (oa *Pair) MarshalText() (bb []byte, err error)

MarshalText implements TextMarshaler interface for Pair

func (Pair) Normalized

func (oa Pair) Normalized() Pair

Normalized converts Pair to its GO-normalized representation

func (Pair) String

func (oa Pair) String() string

String implements Stringer interface for Pair

func (*Pair) UnmarshalJSON

func (oa *Pair) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON is used when reading Pair from JSON streams

func (*Pair) UnmarshalText

func (oa *Pair) UnmarshalText(text []byte) (err error)

UnmarshalText implements TextUnmarshaler interface for Pair

Jump to

Keyboard shortcuts

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