platform

package
v0.0.0-...-4316413 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 5 Imported by: 15

Documentation

Overview

Package platform regroups collecting information about the platform

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArchInfo

func GetArchInfo() (archInfo map[string]string, err error)

GetArchInfo returns basic host architecture information

Types

type Platform

type Platform struct {
	// GoVersion is the golang version.
	GoVersion string
	// GoOS is equal to "runtime.GOOS"
	GoOS string
	// GoArch is equal to "runtime.GOARCH"
	GoArch string

	// KernelName is the kernel name (ex:  "windows", "Linux", ...)
	KernelName string
	// KernelRelease the kernel release (ex: "10.0.20348", "4.15.0-1080-gcp", ...)
	KernelRelease string
	// Hostname is the hostname for the host
	Hostname string
	// Machine the architecture for the host (is: x86_64 vs arm).
	Machine string
	// OS is the os name description (ex: "GNU/Linux", "Windows Server 2022 Datacenter", ...)
	OS string

	// Family is the OS family (Windows only)
	Family string

	// KernelVersion the kernel version, Unix only
	KernelVersion string
	// Processor is the processor type, Unix only (ex "x86_64", "arm", ...)
	Processor string
	// HardwarePlatform is the hardware name, Linux only (ex "x86_64")
	HardwarePlatform string
}

Platform holds metadata about the host

func Get

func Get() (*Platform, []string, error)

Get returns a Platform struct already initialized, a list of warnings and an error. The method will try to collect as much metadata as possible, an error is returned if nothing could be collected. The list of warnings contains errors if some metadata could not be collected.

func (*Platform) Collect

func (platform *Platform) Collect() (result interface{}, err error)

Collect collects the Platform information. Returns an object which can be converted to a JSON or an error if nothing could be collected. Tries to collect as much information as possible.

func (*Platform) Name

func (platform *Platform) Name() string

Name returns the name of the package

Jump to

Keyboard shortcuts

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