arch

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package arch provides information about the currently CPU architecture.

Index

Constants

View Source
const (
	// Invalid describes an unknown architecture or an invalid enum value.
	Invalid T = "invalid"
	// AMD64 describes the amd64 architecture.
	AMD64 = "amd64"
	// I386 describes the i386 architecture.
	I386 = "i386"
)

Variables

View Source
var ErrInvalidBitness = fmt.Errorf("not a valid Bitness, try [%s]", strings.Join(_BitnessNames, ", "))

Functions

func BitnessNames

func BitnessNames() []string

BitnessNames returns a list of possible string values of Bitness.

Types

type Bitness

type Bitness int

Bitness describes the bitness of an architecture.

ENUM( invalid 32Bit = 32 64Bit = 64 )

const (
	// BitnessInvalid is a Bitness of type Invalid.
	BitnessInvalid Bitness = iota
	// Bitness32Bit is a Bitness of type 32Bit.
	Bitness32Bit Bitness = iota + 31
	// Bitness64Bit is a Bitness of type 64Bit.
	Bitness64Bit Bitness = iota + 62
)

func ParseBitness

func ParseBitness(name string) (Bitness, error)

ParseBitness attempts to convert a string to a Bitness.

func (Bitness) MarshalText

func (x Bitness) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Bitness) Short

func (b Bitness) Short() string

Short returns a short, human readable representation of a Bitness.

func (Bitness) String

func (x Bitness) String() string

String implements the Stringer interface.

func (*Bitness) UnmarshalText

func (x *Bitness) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type ErrNotImplemented added in v0.5.0

type ErrNotImplemented struct {
	Message string
}

func (*ErrNotImplemented) Error added in v0.5.0

func (e *ErrNotImplemented) Error() string

type T

type T string

T describes a CPU architecture.

func Native

func Native() T

Native returns the native architecture T of the running process.

func (T) Bitness

func (t T) Bitness() Bitness

Bitness returns the Bitness of the architecture.

Jump to

Keyboard shortcuts

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