crossplatform

package
v0.0.0-...-1092e40 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package common contains interrogation-related code common to multiple platforms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUs

func CPUs(vendor, brandString string) ([]string, error)

CPUs is the brains behind various platform-specific CPUs() functions, broken off for testing. It takes the vendor name (e.g. "GenuineIntel", "AuthenticAMD") and a "brand string", which is a model signifier whose format is vendor-specific (e.g. "Intel(R) Xeon(R) CPU @ 2.00GHz", "AMD EPYC 7B12"), and returns a Swarming-style description of the host's CPU, in various precisions, e.g. ["x86", "x86-64", "x86-64-i5-5350U"]. The first (ISA) and second (bit width) will always be returned (if returned error is nil). The third (model number) will be added if we succeed in extracting it.

Swarming counterpart: https://chromium.googlesource.com/infra/luci/luci-py/+/c3bea95091caef1800d102bae28dfc715a4043bc/appengine/swarming/swarming_bot/api/os_utilities.py#323

func GCEMachineType

func GCEMachineType() (string, error)

GCEMachineType returns the machine type reported by the metadata server. Returns the empty string if not running on GCE.

Inspired by https://chromium.googlesource.com/infra/luci/luci-py/+/84efecd73da77529df8a3fb6e37d232a068e6312/appengine/swarming/swarming_bot/api/platforms/gce.py#90.

func IsDockerInstalled

func IsDockerInstalled(ctx context.Context) bool

IsDockerInstalled returns true if Docker is installed.

func IsGCEMachine

func IsGCEMachine() bool

IsGCEMachine returns true if running on GCE.

func VersionsOfAllPrecisions

func VersionsOfAllPrecisions(prefix, version string) []string

VersionsOfAllPrecisions splits a version like 1.2.3 into an array of versions of all precisions and prepends a constant prefix, resulting in a string slice like {"Mac", "Mac-1", "Mac-1.2", "Mac-1.2.3"}. If version is empty, return only the prefix, like {"Mac"}.

Types

This section is empty.

Jump to

Keyboard shortcuts

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